Browse Source

@不安全行为管理@翟千民

zhongwei
zhaiqm 1 year ago
parent
commit
ada7c67e93
  1. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java
  2. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java
  3. 63
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java
  4. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java
  5. 19
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java
  6. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java

30
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;
}

13
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;
}

63
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<HiddenDanger> pageParam = new Page<>(page, size);
IPage<HiddenDanger> 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("删除成功");
}
}

7
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<HiddenDanger> {
}

19
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<HiddenDanger> {
/**
* 分页查询
* @param pageParam
* @param hiddenDangerQueryVo
* @return
*/
IPage<HiddenDanger> selectPage(Page<HiddenDanger> pageParam, HiddenDangerQueryVo hiddenDangerQueryVo);
}

27
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<HiddenDangerMapper, HiddenDanger> implements HiddenDangerService {
@Override
public IPage<HiddenDanger> selectPage(Page<HiddenDanger> pageParam, HiddenDangerQueryVo hiddenDangerQueryVo) {
String dangerBehavior = hiddenDangerQueryVo.getDangerBehavior();
LambdaQueryWrapper<HiddenDanger> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(dangerBehavior)) {
queryWrapper.like(HiddenDanger::getDangerBehavior,dangerBehavior);
}
IPage<HiddenDanger> hiddenDangerIPage = baseMapper.selectPage(pageParam, queryWrapper);
return hiddenDangerIPage;
}
}
Loading…
Cancel
Save