3 files modified
13 files added
| | |
| | | @ApiOperation(value="巡查设置-通过id删除", notes="巡查设置-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public R delete(@RequestParam(name="id",required=true) String id) { |
| | | patrolConfigService.removeById(id); |
| | | return R.data(patrolConfigService.removeById(id)); |
| | | } |
| | | |
| | |
| | | * 巡查现场图片 |
| | | */ |
| | | @ApiModelProperty("处理图片") |
| | | @TableField(value = "images",typeHandler = FastjsonTypeHandler.class) |
| | | @TableField(value = "images",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED) |
| | | private Object[] images; |
| | | |
| | | /** |
| | | * 巡查现场视频 |
| | | */ |
| | | @ApiModelProperty("处理视频") |
| | | @TableField(value = "videos",typeHandler = FastjsonTypeHandler.class) |
| | | @TableField(value = "videos",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED) |
| | | private Object[] videos; |
| | | |
| | | /** |
| | |
| | | AND r.task_id = #{taskId} |
| | | </select> |
| | | <select id="getByTaskIdAndGroupId" resultMap="selectPatrolRecordList"> |
| | | SELECT r.id,r.patrol_type,r.device_ids,r.images,r.videos,r.content,r.status,r.item_id,r.task_id,r.create_user,r.create_dept,r.solution, |
| | | SELECT c.group_id groupId,r.id,r.patrol_type,r.device_ids,r.images,r.videos,r.content,r.status,r.item_id,r.task_id,r.create_user,r.create_dept,r.solution, |
| | | C.items_name itemsName,C.description FROM SM_PATROL_RECORD r |
| | | RIGHT JOIN ( |
| | | SELECT B.ID,B.GROUP_ID,B.ITEMS_NAME,B.DESCRIPTION |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.controller; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.RulesCondition; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesConditionService; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesService; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Description: 数据规则校验 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "数据规则校验") |
| | | @RestController |
| | | @RequestMapping("/resDataCheck/rulesCondition") |
| | | @AllArgsConstructor |
| | | public class ConditionController extends BladeController { |
| | | |
| | | private IRulesConditionService conditionService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-分页列表查询", notes = "数据规则校验-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public R<IPage<RulesCondition>> queryPageList(RulesCondition rulesCondition, Query query) { |
| | | IPage<RulesCondition> pageList = conditionService.selectRulesConditionPage(Condition.getPage(query), rulesCondition); |
| | | return R.data(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param rulesCondition |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-添加", notes = "数据规则校验-添加") |
| | | @PostMapping(value = "/add") |
| | | public R add(@RequestBody RulesCondition rulesCondition) { |
| | | return R.data(conditionService.save(rulesCondition)); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param rulesCondition |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-编辑", notes = "数据规则校验-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public R edit(@RequestBody RulesCondition rulesCondition) { |
| | | return R.data(conditionService.updateById(rulesCondition)); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-通过id删除", notes = "数据规则校验-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public R delete(@RequestParam(name = "id", required = true) String id) { |
| | | return R.data(conditionService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-批量删除", notes = "数据规则校验-批量删除") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public R deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | return R.data(conditionService.removeByIds(Arrays.asList(ids.split(",")))); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-通过id查询", notes = "数据规则校验-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public R queryById(@RequestParam(name = "id", required = true) String id) { |
| | | RulesCondition rulesCondition = conditionService.getById(id); |
| | | return R.data(rulesCondition); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.controller; |
| | | |
| | | import cn.gistack.sm.patrol.entity.PatrolConfig; |
| | | import cn.gistack.sm.patrol.service.IPatrolConfigService; |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.entity.RulesCondition; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesService; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Description: 数据规则校验 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "数据规则校验") |
| | | @RestController |
| | | @RequestMapping("/resDataCheck/rules") |
| | | @AllArgsConstructor |
| | | public class RulesController extends BladeController { |
| | | |
| | | private IRulesService rulesService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-分页列表查询", notes = "数据规则校验-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public R<IPage<Rules>> queryPageList(Rules rules, Query query) { |
| | | IPage<Rules> pageList = rulesService.selectRulesPage(Condition.getPage(query), rules); |
| | | return R.data(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param rules |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-添加", notes = "数据规则校验-添加") |
| | | @PostMapping(value = "/add") |
| | | public R add(@RequestBody Rules rules) { |
| | | return R.data(rulesService.save(rules)); |
| | | } |
| | | |
| | | /** |
| | | * 自定义添加 |
| | | * |
| | | * @param rulesVO |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-自定义添加", notes = "数据规则校验-自定义添加") |
| | | @PostMapping(value = "/save") |
| | | public R customizeAdd(@RequestBody RulesVO rulesVO){ |
| | | return R.data(rulesService.customizeAdd(rulesVO)); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param rules |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-编辑", notes = "数据规则校验-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public R edit(@RequestBody Rules rules) { |
| | | return R.data(rulesService.updateById(rules)); |
| | | } |
| | | |
| | | /** |
| | | * 自定义编辑 |
| | | * |
| | | * @param rulesVO |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-编辑", notes = "数据规则校验-编辑") |
| | | @RequestMapping(value = "/update", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public R customizeEdit(@RequestBody RulesVO rulesVO) { |
| | | return R.data(rulesService.customizeEdit(rulesVO)); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-通过id删除", notes = "数据规则校验-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public R delete(@RequestParam(name = "id", required = true) String id) { |
| | | return R.data(rulesService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-批量删除", notes = "数据规则校验-批量删除") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public R deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | return R.data(this.rulesService.removeByIds(Arrays.asList(ids.split(",")))); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-通过id查询", notes = "数据规则校验-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public R queryById(@RequestParam(name = "id", required = true) String id) { |
| | | Rules rules = rulesService.getById(id); |
| | | return R.data(rules); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-通过id查询", notes = "数据规则校验-通过id查询") |
| | | @GetMapping(value = "/getDetail") |
| | | public R getDetail(@RequestParam(name = "id", required = true) String id) { |
| | | RulesVO rulesVO = rulesService.getDetail(id); |
| | | return R.data(rulesVO); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | |
| | | /** |
| | | * @Description: 水库数据校验规则表 |
| | | */ |
| | | @Data |
| | | @TableName("SM_RES_DATA_CHECK_RULES") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="SM_RES_DATA_CHECK_RULES对象", description="水库数据校验规则表") |
| | | public class Rules extends BaseEntity { |
| | | |
| | | /** |
| | | *校验规则名称 |
| | | */ |
| | | @ApiModelProperty(" 校验规则名称") |
| | | private String name; |
| | | |
| | | /** |
| | | *校验规则描述 |
| | | */ |
| | | @ApiModelProperty("校验规则描述") |
| | | private String description; |
| | | |
| | | /** |
| | | *数据校验类型(数据字典) |
| | | */ |
| | | @ApiModelProperty(" 校验数据类型(数据字典)") |
| | | private String type; |
| | | |
| | | /** |
| | | *水库ids(多选) |
| | | */ |
| | | @ApiModelProperty("水库ids(多选)") |
| | | private String reservoirIds; |
| | | |
| | | /** |
| | | *水库名称 |
| | | */ |
| | | @ApiModelProperty("水库名称") |
| | | private String reservoirNames; |
| | | |
| | | /** |
| | | *是香重复执行(1、是: 2、否) |
| | | */ |
| | | @ApiModelProperty(" 是否重复执行(1、是: 2、否)") |
| | | private String repeat; |
| | | |
| | | /** |
| | | *生效开始时间 |
| | | */ |
| | | @ApiModelProperty(" 生效开始时间") |
| | | private String activeStartTime; |
| | | |
| | | /** |
| | | *生效结束时间 |
| | | */ |
| | | @ApiModelProperty(" 生效结束时间") |
| | | private String activeEndTime; |
| | | |
| | | /** |
| | | *第一次执行时间 |
| | | */ |
| | | @ApiModelProperty(" 第一次执行时间") |
| | | private String firstExecuteTime; |
| | | |
| | | /** |
| | | *重复执行间隔 |
| | | */ |
| | | @ApiModelProperty(" 重复执行间隔") |
| | | private String repeatGap; |
| | | |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | |
| | | /** |
| | | * @Description: 数据校验规则条件表 |
| | | */ |
| | | @Data |
| | | @TableName("SM_RES_DATA_CHECK_RULES_CONDITION") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="SM_RES_DATA_CHECK_RULES_CONDITION对象", description="数据校验规则条件表") |
| | | public class RulesCondition extends BaseEntity { |
| | | |
| | | /** |
| | | *规则id |
| | | */ |
| | | @ApiModelProperty(" 规则id") |
| | | private String ruleId; |
| | | |
| | | /** |
| | | *关联类型(第一个默认为WHILE,后面的补充数据选填AND、OR)数据字典(CON_RELATION) |
| | | */ |
| | | @ApiModelProperty("关联类型(第一个默认为WHILE,后面的补充数据选填AND、OR)数据字典(CON_RELATION)") |
| | | private String relation; |
| | | |
| | | /** |
| | | *比较字段;数据字典(CON_BASIC) |
| | | */ |
| | | @ApiModelProperty("比较字段;数据字典(CON_BASIC)") |
| | | private String basic; |
| | | |
| | | /** |
| | | *大于小于等于;数据字典(CON_CONDITION) |
| | | */ |
| | | @ApiModelProperty("大于小于等于;数据字典(CON_CONDITION)") |
| | | private String condition; |
| | | |
| | | /** |
| | | *值、指标、空值;数据字典(CON_PROP) |
| | | */ |
| | | @ApiModelProperty("值、指标、空值;数据字典(CON_PROP)") |
| | | private String prop; |
| | | |
| | | /** |
| | | *值(数据字典或值) |
| | | */ |
| | | @ApiModelProperty(" 值(数据字典或值)") |
| | | private String value; |
| | | |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.mapper; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.entity.RulesCondition; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 数据校验规则 |
| | | */ |
| | | public interface RulesConditionMapper extends BaseMapper<RulesCondition> { |
| | | |
| | | List<RulesCondition> selectRulesConditionPage(IPage<RulesCondition> page, RulesCondition rulesCondition); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.gistack.sm.resDataCheck.mapper.RulesConditionMapper"> |
| | | |
| | | |
| | | <select id="selectRulesConditionPage" resultType="cn.gistack.sm.resDataCheck.entity.RulesCondition"></select> |
| | | </mapper> |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.mapper; |
| | | |
| | | import cn.gistack.sm.patrol.entity.PatrolConfig; |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 数据校验规则 |
| | | */ |
| | | public interface RulesMapper extends BaseMapper<Rules> { |
| | | |
| | | List<Rules> selectRulesPage(IPage<Rules> page, @Param("rules") Rules rules); |
| | | |
| | | RulesVO getDetail(@Param("id") String id); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.gistack.sm.resDataCheck.mapper.RulesMapper"> |
| | | |
| | | |
| | | <select id="selectRulesPage" resultType="cn.gistack.sm.resDataCheck.entity.Rules"> |
| | | SELECT * FROM SM_RES_DATA_CHECK_RULES WHERE IS_DELETED = 0 |
| | | <if test="rules.reservoirNames !=null and rules.reservoirNames !=''"> |
| | | AND RESERVOIR_NAMES LIKE CONCAT('%',#{rules.reservoirNames},'%') |
| | | </if> |
| | | <if test="rules.name !=null and rules.name !=''"> |
| | | AND name LIKE CONCAT('%',#{rules.name},'%') |
| | | </if> |
| | | <if test="rules.type !=null and rules.type !=''"> |
| | | AND type = #{rules.type} |
| | | </if> |
| | | </select> |
| | | <select id="getDetail" resultType="cn.gistack.sm.resDataCheck.vo.RulesVO"> |
| | | SELECT * FROM SM_RES_DATA_CHECK_RULES WHERE IS_DELETED = 0 AND ID=#{id} |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.service; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.entity.RulesCondition; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | |
| | | /** |
| | | * 数据校验规则 |
| | | */ |
| | | public interface IRulesConditionService extends BaseService<RulesCondition> { |
| | | IPage<RulesCondition> selectRulesConditionPage(IPage<RulesCondition> page, RulesCondition rulesCondition); |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.service; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | |
| | | /** |
| | | * 数据校验规则 |
| | | */ |
| | | public interface IRulesService extends BaseService<Rules> { |
| | | IPage<Rules> selectRulesPage(IPage<Rules> page, Rules rules); |
| | | |
| | | Boolean customizeAdd(RulesVO rulesVO); |
| | | |
| | | Boolean customizeEdit(RulesVO rulesVO); |
| | | |
| | | RulesVO getDetail(String id); |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.service.impl; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.entity.RulesCondition; |
| | | import cn.gistack.sm.resDataCheck.mapper.RulesConditionMapper; |
| | | import cn.gistack.sm.resDataCheck.mapper.RulesMapper; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesConditionService; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesService; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 数据校验规则 |
| | | */ |
| | | @Service |
| | | public class RulesConditionServiceImpl extends BaseServiceImpl<RulesConditionMapper, RulesCondition> implements IRulesConditionService { |
| | | |
| | | @Override |
| | | public IPage<RulesCondition> selectRulesConditionPage(IPage<RulesCondition> page, RulesCondition rulesCondition) { |
| | | return page.setRecords(baseMapper.selectRulesConditionPage(page,rulesCondition)); |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.service.impl; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.entity.RulesCondition; |
| | | import cn.gistack.sm.resDataCheck.mapper.RulesMapper; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesConditionService; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesService; |
| | | import cn.gistack.sm.resDataCheck.vo.RulesVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 数据校验规则 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class RulesServiceImpl extends BaseServiceImpl<RulesMapper, Rules> implements IRulesService { |
| | | private final IRulesConditionService rulesConditionService; |
| | | |
| | | @Override |
| | | public IPage<Rules> selectRulesPage(IPage<Rules> page, Rules rules) { |
| | | return page.setRecords(baseMapper.selectRulesPage(page,rules)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean customizeAdd(RulesVO rulesVO) { |
| | | //保存rules |
| | | boolean saveRules = save(rulesVO); |
| | | |
| | | //condition保存规则id |
| | | rulesVO.getRulesConditionList().forEach(condition->{ |
| | | condition.setRuleId(rulesVO.getId().toString()); |
| | | }); |
| | | |
| | | //批量保存condition |
| | | boolean saveCondition = rulesConditionService.saveBatch(rulesVO.getRulesConditionList()); |
| | | |
| | | return saveRules&&saveCondition; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean customizeEdit(RulesVO rulesVO) { |
| | | //更新rules |
| | | boolean updateRules = updateById(rulesVO); |
| | | |
| | | rulesVO.getRulesConditionList().forEach(condition->{ |
| | | //有id,更新 |
| | | if (ObjectUtil.isNotEmpty(condition.getId())){ |
| | | rulesConditionService.updateById(condition); |
| | | }else { |
| | | //没id,赋rulesId |
| | | condition.setRuleId(rulesVO.getId().toString()); |
| | | rulesConditionService.save(condition); |
| | | } |
| | | }); |
| | | return updateRules; |
| | | } |
| | | |
| | | @Override |
| | | public RulesVO getDetail(String id) { |
| | | RulesVO rulesVO = baseMapper.getDetail(id); |
| | | RulesCondition rulesCondition = new RulesCondition(); |
| | | rulesCondition.setRuleId(id); |
| | | |
| | | List<RulesCondition> list = rulesConditionService.list(Condition.getQueryWrapper(rulesCondition)); |
| | | rulesVO.setRulesConditionList(list); |
| | | |
| | | return rulesVO; |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.vo; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.entity.RulesCondition; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class RulesVO extends Rules { |
| | | private List<RulesCondition> rulesConditionList; |
| | | } |