| | |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.AchieveRule; |
| | | import com.matrix.system.hive.dao.AchieveRuleDao; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.hiveErp.pojo.AchieveRuleItem; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody @Validated AchieveRule achieveRule) { |
| | | |
| | | WebUtil.setSessionAttribute(MatrixConstance.LOGIN_KEY,sysUsersDao.selectById(2L)); |
| | | |
| | | if(CollectionUtils.isEmpty(achieveRule.getRuleItemList())){ |
| | | return AjaxResult.buildFailInstance("规则设置不能为空"); |
| | | } |
| | | |
| | | String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList()); |
| | | achieveRule.setRules(rules); |
| | | |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody @Validated AchieveRule achieveRule) { |
| | | WebUtil.setSessionAttribute(MatrixConstance.LOGIN_KEY,sysUsersDao.selectById(2L)); |
| | | |
| | | if (achieveRule.getId() == null) { |
| | | return AjaxResult.buildFailInstance("id不能为空"); |
| | | } |
| | | |
| | | if(CollectionUtils.isEmpty(achieveRule.getRuleItemList())){ |
| | | return AjaxResult.buildFailInstance("规则设置不能为空"); |
| | | } |
| | | String rules = JSONUtil.toJsonStr(achieveRule.getRuleItemList()); |
| | | achieveRule.setRules(rules); |
| | | |
| | |
| | | @GetMapping("/removeById/{id}") |
| | | public AjaxResult removeById(@PathVariable Long id) { |
| | | achieveRuleDao.deleteById(id); |
| | | return AjaxResult.buildFailInstance("删除成功"); |
| | | return AjaxResult.buildSuccessInstance("删除成功"); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @PostMapping("/selectList") |
| | | public AjaxResult selectList(@RequestBody BasePageQueryDto pageDto) { |
| | | WebUtil.setSessionAttribute(MatrixConstance.LOGIN_KEY,sysUsersDao.selectById(2L)); |
| | | |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | Page<AchieveRule> page = new Page<>(pageDto.getPageNum(), pageDto.getPageSize()); |
| | | LambdaQueryWrapper<AchieveRule> lambdaQueryWrapper = new LambdaQueryWrapper<AchieveRule>() |