diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java new file mode 100644 index 0000000..1924629 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.hiddendanger.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hidden_danger") +public class HiddenDanger { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 危险行为 + */ + @TableField("danger_behavior") + private String dangerBehavior; + + /** + * 发生次数 + */ + @TableField("times") + private Integer times; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java new file mode 100644 index 0000000..384bab9 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.safeproduct.hiddendanger.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +@Data +public class HiddenDangerQueryVo { + /** + * 危险行为 + */ + @TableField("danger_behavior") + private String dangerBehavior; +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java new file mode 100644 index 0000000..bea8663 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java @@ -0,0 +1,63 @@ +package com.hnac.hzims.safeproduct.hiddendanger.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; +import com.hnac.hzims.safeproduct.hiddendanger.service.HiddenDangerService; +import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo; +import lombok.RequiredArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/hiddendanger") +public class HiddenDangerController { + + @Autowired + HiddenDangerService hiddenDangerService; + + /** + * 分页查询 + */ + @GetMapping("/listPage/{page}/{size}") + public R listPage(@PathVariable Long page, + @PathVariable Long size, + HiddenDangerQueryVo hiddenDangerQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = + hiddenDangerService.selectPage(pageParam, + hiddenDangerQueryVo); + return R.data(resultParams); + } + + /** + * 新增指标项管理 + */ + @PostMapping("/save") + public R save(@RequestBody HiddenDanger hiddenDanger) { + hiddenDangerService.save(hiddenDanger); + return R.success("新增成功"); + } + + + /** + * 更新指标项管理 + */ + @PutMapping("/update") + public R update(@RequestBody HiddenDanger hiddenDanger) { + hiddenDangerService.updateById(hiddenDanger); + return R.success("修改成功"); + } + + + /** + * 删除指标项管理 + */ + @DeleteMapping("/remove/{id}") + public R remove(@PathVariable Long id) { + hiddenDangerService.removeById(id); + return R.success("删除成功"); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java new file mode 100644 index 0000000..a7a4c7a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.safeproduct.hiddendanger.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; + +public interface HiddenDangerMapper extends BaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java new file mode 100644 index 0000000..35b3dc9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.hiddendanger.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; +import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo; + +public interface HiddenDangerService extends IService { + + + /** + * 分页查询 + * @param pageParam + * @param hiddenDangerQueryVo + * @return + */ + IPage selectPage(Page pageParam, HiddenDangerQueryVo hiddenDangerQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java new file mode 100644 index 0000000..2632dbc --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.safeproduct.hiddendanger.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; +import com.hnac.hzims.safeproduct.hiddendanger.mapper.HiddenDangerMapper; +import com.hnac.hzims.safeproduct.hiddendanger.service.HiddenDangerService; +import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo; +import org.springframework.stereotype.Service; + +@Service +public class HiddenDangerServiceImpl extends ServiceImpl implements HiddenDangerService { + @Override + public IPage selectPage(Page pageParam, HiddenDangerQueryVo hiddenDangerQueryVo) { + String dangerBehavior = hiddenDangerQueryVo.getDangerBehavior(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(dangerBehavior)) { + queryWrapper.like(HiddenDanger::getDangerBehavior,dangerBehavior); + } + IPage hiddenDangerIPage = baseMapper.selectPage(pageParam, queryWrapper); + + return hiddenDangerIPage; + } +}