|
|
@@ -1,6 +1,7 @@
|
|
|
package org.jeecg.modules.medical.controller;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -9,9 +10,17 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.medical.Constant;
|
|
|
+import org.jeecg.modules.medical.EnchanceTypeEnum;
|
|
|
import org.jeecg.modules.medical.entity.FactorEnchance;
|
|
|
import org.jeecg.modules.medical.service.IFactorEnchanceService;
|
|
|
|
|
|
@@ -69,6 +78,7 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
|
|
|
HttpServletRequest req) {
|
|
|
QueryWrapper<FactorEnchance> queryWrapper = QueryGenerator.initQueryWrapper(factorEnchance, req.getParameterMap());
|
|
|
Page<FactorEnchance> page = new Page<FactorEnchance>(pageNo, pageSize);
|
|
|
+ queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0);
|
|
|
IPage<FactorEnchance> pageList = factorEnchanceService.page(page, queryWrapper);
|
|
|
return Result.OK(pageList);
|
|
|
}
|
|
|
@@ -84,7 +94,25 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
|
|
|
@RequiresPermissions("medical:factor_enchance:add")
|
|
|
@PostMapping(value = "/add")
|
|
|
public Result<String> add(@RequestBody FactorEnchance factorEnchance) {
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ if(sysUser!=null){
|
|
|
+// dto.setUserid(sysUser.getUsername());
|
|
|
+// dto.setUsername(sysUser.getRealname());
|
|
|
+ factorEnchance.setCreateBy(sysUser.getUsername());
|
|
|
+ factorEnchance.setCreateTime(new Date(System.currentTimeMillis()));
|
|
|
+ factorEnchance.setState(Constant.EFF_STATE);
|
|
|
+ factorEnchance.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
+ }
|
|
|
factorEnchanceService.save(factorEnchance);
|
|
|
+ EnchanceTypeEnum enchanceTypeEnum = EnchanceTypeEnum.getType(factorEnchance.getEnhanceType());
|
|
|
+ switch (enchanceTypeEnum){
|
|
|
+ case SQL:
|
|
|
+ factorEnchanceService.saveSqlFactorEnchance(factorEnchance);
|
|
|
+ break;
|
|
|
+ case LOGICAL_EXPRESSION:
|
|
|
+ factorEnchanceService.saveLogicalFactorEnchance(factorEnchance);
|
|
|
+ break;
|
|
|
+ }
|
|
|
return Result.OK("添加成功!");
|
|
|
}
|
|
|
|
|
|
@@ -99,6 +127,13 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
|
|
|
@RequiresPermissions("medical:factor_enchance:edit")
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
public Result<String> edit(@RequestBody FactorEnchance factorEnchance) {
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ if(sysUser!=null){
|
|
|
+// dto.setUserid(sysUser.getUsername());
|
|
|
+// dto.setUsername(sysUser.getRealname());
|
|
|
+ factorEnchance.setUpdateBy(sysUser.getUsername());
|
|
|
+ factorEnchance.setUpdateTime(new Date(System.currentTimeMillis()));
|
|
|
+ }
|
|
|
factorEnchanceService.updateById(factorEnchance);
|
|
|
return Result.OK("编辑成功!");
|
|
|
}
|
|
|
@@ -114,7 +149,11 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
|
|
|
@RequiresPermissions("medical:factor_enchance:delete")
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- factorEnchanceService.removeById(id);
|
|
|
+ Wrapper<FactorEnchance> updateWrapper = new UpdateWrapper<>();
|
|
|
+
|
|
|
+ factorEnchanceService.lambdaUpdate().set(FactorEnchance::getDelFlag, CommonConstant.DEL_FLAG_1).eq(FactorEnchance::getId, Integer.parseInt(id)).update();
|
|
|
+// factorEnchanceService.updateById(factorEnchance);
|
|
|
+// factorEnchanceService.removeById(id);
|
|
|
return Result.OK("删除成功!");
|
|
|
}
|
|
|
|