| | |
| | | <name>mom_ocean</name> |
| | | <description>mom_ocean</description> |
| | | <packaging>pom</packaging> |
| | | <!--test--> |
| | | |
| | | <modules> |
| | | <module>framework</module> |
| | | <module>user-server</module> |
| | |
| | | import com.yuanchu.mom.service.DeviceService; |
| | | import com.yuanchu.mom.service.RawInsProductService; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | return Result.success(maps); |
| | | } |
| | | |
| | | @ApiOperation(value = "二级树", tags = "QMS管理-->实验室管理") |
| | | @ApiOperation(value = "二级树:默认生产设备", tags = "QMS管理-->实验室管理") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "type", value = "类型", dataTypeClass = String.class) |
| | | @ApiImplicitParam(name = "type", value = "类型", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "search_class", value = "搜索框内容", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/two_tree") |
| | | public Result<?> deviceTwoTree(@RequestParam(defaultValue = "1") Integer type){ |
| | | List<Map<String, Object>> mapList= deviceService.deviceTwoTree(type); |
| | | public Result<?> deviceTwoTree(@RequestParam(defaultValue = "1") Integer type, String search_class){ |
| | | List<Map<String, Object>> mapList= deviceService.deviceTwoTree(type, search_class); |
| | | return Result.success(mapList); |
| | | } |
| | | |
| | |
| | | IPage<Map<String, Object>> mapList = rawInsProductService.selectPageDevice(pageNo, pageSize, codeOrNameOrModel); |
| | | return Result.success(mapList); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增仪器设备:根据检验项目ID查询数据", tags = "QMS管理-->实验室管理") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "inspectId", value = "检验项目Id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/inspectId") |
| | | public Result<?> inspectIdSelect(Integer inspectId){ |
| | | Map<String, Object> map = rawInsProductService.inspectIdSelect(inspectId); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增仪器设备:查询父级分类", tags = "QMS管理-->实验室管理") |
| | | @GetMapping("/parent_classification") |
| | | public Result<?> parentClassification(){ |
| | | List<Map<String, Object>> map = rawInsProductService.parentClassification(); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "实验室模块表格数据", tags = "QMS管理-->实验室管理") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "type", value = "类型:默认生产设备", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "codeNameModel", value = "编号名称规格型号", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "deviceStatue", value = "设备状态", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "deviceId", value = "设备Id", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "fatherName", value = "父级分类", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/table_list") |
| | | public Result<?> tableData(String codeNameModel, @RequestParam(defaultValue = "1") Integer type, Integer deviceStatue, Integer deviceId, String fatherName){ |
| | | List<Map<String, Object>> map = deviceService.DevicePageList(codeNameModel, type, deviceStatue, deviceId, fatherName); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除实验室模块数据", tags = "QMS管理-->实验室管理") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "deviceId", value = "根据设备Id删除", dataTypeClass = Integer.class) |
| | | }) |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deviceDelete(Integer deviceId){ |
| | | Integer map = deviceService.deviceDelete(deviceId); |
| | | if (map == 1){ |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除树模块数据", tags = "QMS管理-->实验室管理") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "根据设备Id删除", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "deviceFather", value = "根据设备分类删除", dataTypeClass = String.class) |
| | | }) |
| | | @DeleteMapping("/deleteIdorFather") |
| | | public Result<?> deviceDeleteIdOrFather(Integer id, String deviceFather){ |
| | | Integer map = deviceService.deviceDeleteIdOrFather(id, deviceFather); |
| | | if (map == 1){ |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public interface DeviceMapper extends BaseMapper<Device> { |
| | | |
| | | List<Map<String, Object>> deviceTwoTree(Integer type); |
| | | List<Map<String, Object>> deviceTwoTree(Integer type, String search_class); |
| | | |
| | | List<Map<String, Object>> DevicePageList(String codeNameModel, Integer type, Integer deviceStatue, Integer deviceId, String fatherName); |
| | | } |
| | |
| | | List<Map<String, Object>> selectInspectIdAndName(); |
| | | |
| | | IPage<Map<String, Object>> selectPageDevice(Integer pageNo, Integer pageSize, String codeOrNameOrModel); |
| | | |
| | | Map<String, Object> inspectIdSelect(Integer inspectId); |
| | | |
| | | List<Map<String, Object>> parentClassification(); |
| | | } |
| | | |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "设备id") |
| | | @ApiModelProperty(value = "设备id", hidden = true) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Boolean addDevice(Device device); |
| | | |
| | | List<Map<String, Object>> deviceTwoTree(Integer type); |
| | | List<Map<String, Object>> deviceTwoTree(Integer type, String search_class); |
| | | |
| | | List<Map<String, Object>> DevicePageList(String codeNameModel, Integer type, Integer deviceStatue, Integer deviceId, String fatherName); |
| | | |
| | | Integer deviceDelete(Integer deviceId); |
| | | |
| | | Integer deviceDeleteIdOrFather(Integer id, String deviceFather); |
| | | } |
| | |
| | | List<Map<String, Object>> selectInspectIdAndName(); |
| | | |
| | | IPage<Map<String, Object>> selectPageDevice(Integer pageNo, Integer pageSize, String codeOrNameOrModel); |
| | | |
| | | Map<String, Object> inspectIdSelect(Integer inspectId); |
| | | |
| | | List<Map<String, Object>> parentClassification(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> deviceTwoTree(Integer type) { |
| | | return deviceMapper.deviceTwoTree(type); |
| | | public List<Map<String, Object>> deviceTwoTree(Integer type, String search_class) { |
| | | return deviceMapper.deviceTwoTree(type, search_class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> DevicePageList(String codeNameModel,Integer type, Integer deviceStatue, Integer deviceId, String fatherName) { |
| | | return deviceMapper.DevicePageList(codeNameModel, type, deviceStatue, deviceId, fatherName); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deviceDelete(Integer deviceId) { |
| | | LambdaUpdateWrapper<Device> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Device::getId, deviceId); |
| | | updateWrapper.set(Device::getState, 0); |
| | | return deviceMapper.update(new Device(), updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deviceDeleteIdOrFather(Integer id, String deviceFather) { |
| | | LambdaUpdateWrapper<Device> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.set(Device::getState, 0); |
| | | if (id != null) { |
| | | updateWrapper.eq(Device::getId, id); |
| | | } else if (deviceFather != null) { |
| | | updateWrapper.eq(Device::getFather, deviceFather); |
| | | } |
| | | return deviceMapper.update(new Device(), updateWrapper); |
| | | } |
| | | } |
| | |
| | | return rawInsProductMapper.selectPageDevice(pageNo, pageSize, codeOrNameOrModel); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> inspectIdSelect(Integer inspectId) { |
| | | return rawInsProductMapper.inspectIdSelect(inspectId); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> parentClassification() { |
| | | return rawInsProductMapper.parentClassification(); |
| | | } |
| | | |
| | | /*判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格*/ |
| | | private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | |
| | | </select> |
| | | |
| | | <resultMap id="deviceTwoTreeOneMap" type="map"> |
| | | <id property="father" column="father"/> |
| | | <id property="name" column="father"/> |
| | | <collection property="children" resultMap="deviceTwoTreeTwoMap" javaType="List"/> |
| | | </resultMap> |
| | | |
| | |
| | | SELECT d.`id`, d.`name`, d.`father` |
| | | FROM device d |
| | | WHERE d.state = 1 |
| | | AND d.type = #{type} |
| | | AND d.type = #{type} |
| | | <if test="search_class !=null and search_class != ''"> |
| | | AND d.`name` like concat('%',#{search_class},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="DevicePageList" resultType="Map"> |
| | | SELECT * FROM device d |
| | | LEFT JOIN raw_ins_product r |
| | | ON d.`id` = r.`device_id` |
| | | SELECT d.id, d.`code`, d.`name`, u.`name` keeper, DATE_FORMAT(d.`end_measure`,'%Y-%m-%d') end_measure, d.`device_status`, d.`factory`, r.`name` inspectProject, i.`name` testSample, i.`user_name` |
| | | FROM (device d, `user` u) |
| | | LEFT JOIN raw_ins_product r |
| | | ON d.`id` = r.`device_id` |
| | | LEFT JOIN raw_inspect i |
| | | ON r.`raw_inspect_id` = i.`id` |
| | | WHERE r.`test_state` IS NULL |
| | | AND d.`state` = 1 |
| | | AND (r.`state` = 1 OR r.`state` IS NULL) |
| | | AND d.`keeper` = u.`id` |
| | | AND d.type = #{type} |
| | | <if test="codeNameModel != null and codeNameModel != ''"> |
| | | AND (d.`name` LIKE CONCAT('%',#{codeNameModel},'%') OR d.`code` LIKE CONCAT('%',#{codeNameModel},'%') OR i.`specifications` LIKE CONCAT('%',#{codeNameModel},'%')) |
| | | </if> |
| | | <if test="deviceStatue != null and deviceStatue != ''"> |
| | | AND d.`device_status` = #{deviceStatue} |
| | | </if> |
| | | <if test="deviceId != null and deviceId != ''"> |
| | | AND d.id = #{deviceId} |
| | | </if> |
| | | <if test="fatherName != null and fatherName != ''"> |
| | | AND d.`father` = #{fatherName} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="selectPageDevice" resultType="map"> |
| | | |
| | | </select> |
| | | |
| | | <select id="inspectIdSelect" resultType="map"> |
| | | SELECT r.`name`, r.`specifications`, r.`user_name` |
| | | FROM raw_inspect r, raw_ins_product p |
| | | WHERE p.`id` = #{inspectId} |
| | | AND p.`state` = 1 |
| | | AND r.`state` = 1 |
| | | AND r.`id` = p.`raw_inspect_id` |
| | | </select> |
| | | |
| | | <select id="parentClassification" resultType="map"> |
| | | SELECT DISTINCT d.`father` |
| | | FROM device d |
| | | WHERE d.`state` = 1 |
| | | AND d.`father` IS NOT NULL |
| | | </select> |
| | | </mapper> |