增加初始化员工配置记录接口
This commit is contained in:
parent
ff11bbb16f
commit
5f825db580
@ -2,6 +2,7 @@ package com.ruoyi.system.fantang.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.fantang.service.*;
|
||||
@ -215,6 +216,13 @@ public class ClientController extends BaseController {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PostMapping("/initDemandMode")
|
||||
public AjaxResult initDemandMode(@RequestBody JSONObject params) {
|
||||
return staffDemandDaoService.initDemandMode(params.getLong("staffId"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置订餐模式
|
||||
* 日期:2020年12月11日
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.ruoyi.system.fantang.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.system.fantang.domain.FtStaffDemandDao;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
|
||||
/**
|
||||
* 员工报餐Mapper接口
|
||||
@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface FtStaffDemandDaoMapper extends BaseMapper<FtStaffDemandDao> {
|
||||
|
||||
@Insert("INSERT into ft_staff_demand (staff_id, type, demand_mode) VALUES (#{staffId}, 1, 0),(#{staffId}, 2, 0),(#{staffId}, 3, 0)")
|
||||
Integer initDemandMode(Long staffId);
|
||||
}
|
||||
|
@ -15,4 +15,6 @@ public interface IFtStaffDemandDaoService extends IService<FtStaffDemandDao> {
|
||||
AjaxResult getConfiguration(Long staffId);
|
||||
|
||||
AjaxResult setDemandMode(Long id, Integer type, Boolean demandModeFlag);
|
||||
|
||||
AjaxResult initDemandMode(Long staffId);
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ import com.ruoyi.system.fantang.mapper.FtStaffDemandDaoMapper;
|
||||
import com.ruoyi.system.fantang.domain.FtStaffDemandDao;
|
||||
import com.ruoyi.system.fantang.service.IFtStaffDemandDaoService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 员工报餐Service业务层处理
|
||||
@ -42,4 +44,19 @@ public class FtStaffDemandDaoServiceImpl extends ServiceImpl<FtStaffDemandDaoMap
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult initDemandMode(Long staffId) {
|
||||
// 先删除该员工的配置信息
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("staff_id", staffId);
|
||||
int ret = this.baseMapper.deleteByMap(map);
|
||||
// 初始化三条订餐配置信息
|
||||
this.baseMapper.initDemandMode(staffId);
|
||||
|
||||
// 重新检索返回给前端
|
||||
QueryWrapper<FtStaffDemandDao> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("staff_id", staffId);
|
||||
return AjaxResult.success(this.baseMapper.selectList(wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user