| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.pojo.Device; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | return Result.success(deviceService.search(status, deviceName, specificationModel, largeCategory)); |
| | | } |
| | | |
| | | //图片上传 |
| | | @ApiOperation(value = "图片上传") |
| | | @RequestMapping(value = "/uploadFile", method = RequestMethod.POST) |
| | | public Result uploadFile(MultipartFile file, HttpServletRequest request) throws IOException { |
| | | //获取文件名称 |
| | | HashMap<String, String> list = new HashMap<>(); |
| | | String filename = file.getOriginalFilename(); |
| | | String s = filename.substring(filename.lastIndexOf("."), filename.length()); |
| | | |
| | | System.out.println(filename); |
| | | //获取真实路径 |
| | | String realPath = request.getServletContext().getRealPath("/Users/gaoaoy/webapp/images"); |
| | | //创建文件 |
| | | File file1 = new File(realPath); |
| | | if (!file1.exists()) { |
| | | file1.mkdirs(); |
| | | } |
| | | file.transferTo(new File(file1 + "/" + filename)); |
| | | String ss= filename; |
| | | UUID uuid = UUID.randomUUID(); |
| | | ss = uuid.toString() + s; |
| | | String ful = "/Users/gaoaoy/webapp/images" + ss; |
| | | System.out.println(file1); |
| | | |
| | | list.put("url", ful); |
| | | list.put("name", filename); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取设备负责人") |
| | | @GetMapping("/selectDevicePrincipal") |
| | | @ValueAuth |
| | | public Result selectDevicePrincipal() { |
| | | return Result.success(deviceService.selectDevicePrincipal()); |
| | | } |
| | | } |
| | | |
| | |
| | | public interface DeviceMapper extends BaseMapper<Device> { |
| | | |
| | | IPage<Device> selectDeviceParameter(Page page, QueryWrapper<Device> ew); |
| | | List<Device> selectEquipmentOverview(Page page, QueryWrapper<Device> ew); |
| | | |
| | | List<Device> selectEquipmentOverview(); |
| | | //更新 |
| | | int upDeviceParameter(Device itemParameter); |
| | | |
| | | List<Device> authorizedPerson(); |
| | | |
| | | List<Device> search(@Param(value = "status") Integer status, @Param(value = "deviceName") String deviceName, |
| | | @Param(value = "specificationModel") String specificationModel, @Param(value = "largeCategory") String largeCategory); |
| | | |
| | | //获取图片数据 |
| | | void selectDeviceImage(@Param(value = "name") String name ,@Param(value = "id") Integer id); |
| | | |
| | | //查询设备负责人 |
| | | List<Device> selectDevicePrincipal(); |
| | | } |
| | | |
| | |
| | | private String accurateMeasurement; |
| | | |
| | | @ValueTableShow(16) |
| | | @ApiModelProperty(value = "备注") |
| | | private String notes; |
| | | |
| | | @ValueTableShow(17) |
| | | @ApiModelProperty(value = "规格型号") |
| | | private String specificationModel; |
| | | |
| | | @ValueTableShow(17) |
| | | @ValueTableShow(18) |
| | | @ApiModelProperty(value = "设备状态") |
| | | private String deviceStatus; |
| | | |
| | | @ValueTableShow(18) |
| | | @ValueTableShow(19) |
| | | @ApiModelProperty(value = "存放点") |
| | | private String storagePoint; |
| | | |
| | | @ValueTableShow(19) |
| | | @ValueTableShow(20) |
| | | @ApiModelProperty(value = "最近追溯日期") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime latestTraceability; |
| | | |
| | | @ValueTableShow(20) |
| | | @ValueTableShow(21) |
| | | @ApiModelProperty(value = "停用时间") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime downTime; |
| | | |
| | | @ValueTableShow(21) |
| | | @ValueTableShow(22) |
| | | @ApiModelProperty(value = "维修记录") |
| | | private String maintenanceRecords; |
| | | |
| | | @ValueTableShow(22) |
| | | @ValueTableShow(23) |
| | | @ApiModelProperty(value = "生产厂家") |
| | | private String manufacturer; |
| | | |
| | | @ValueTableShow(23) |
| | | @ValueTableShow(24) |
| | | @ApiModelProperty(value = "检测类型") |
| | | private String detectionType; |
| | | |
| | | @ValueTableShow(24) |
| | | @ValueTableShow(25) |
| | | @ApiModelProperty(value = "采购费用") |
| | | private String procurementCosts; |
| | | |
| | | @ValueTableShow(25) |
| | | @ValueTableShow(26) |
| | | @ApiModelProperty(value = "校准证书") |
| | | private String calibrationCerticate; |
| | | |
| | | @ValueTableShow(26) |
| | | @ValueTableShow(27) |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer status; |
| | | |
| | | @ValueTableShow(28) |
| | | @ApiModelProperty(value = "图片上传") |
| | | private Integer imageUpload; |
| | | |
| | | @ValueTableShow(29) |
| | | @ApiModelProperty(value = "图片备注") |
| | | private Integer imageName; |
| | | |
| | | @ApiModelProperty(value = "创建人id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | |
| | |
| | | */ |
| | | public interface DeviceService extends IService<Device> { |
| | | |
| | | Map<String, Object> selectDeviceParameter(Page page, Device itemParameter); |
| | | Map<String, Object> selectDeviceParameter(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, Device itemParameter); |
| | | |
| | | int addDeviceParameter(Device itemParameter); |
| | | |
| | |
| | | |
| | | List<Device> authorizedPerson(); |
| | | |
| | | List<Device> search( Integer status, String deviceName, String specificationModel, String largeCategory); |
| | | List<Device> search(Integer status, String deviceName, String specificationModel, String largeCategory); |
| | | |
| | | List<Device> selectDevicePrincipal(); |
| | | |
| | | } |
| | | |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Override |
| | | public Map<String, Object> selectDeviceParameter(Page page, Device itemParameter) { |
| | | public Map<String, Object> selectDeviceParameter(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, Device itemParameter) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(Device.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectDeviceParameter"); |
| | | if (map1.get("look") == 1) itemParameter.setCreateUser(map1.get("userId")); |
| | | map.put("body", deviceMapper.selectDeviceParameter(page, QueryWrappers.queryWrappers(itemParameter))); |
| | | // deviceMapper.selectPage(page, QueryWrappers.queryWrappers(itemParameter)); |
| | | map.put("body", deviceMapper.selectPage(page, QueryWrappers.queryWrappers(itemParameter))); |
| | | return map; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<Device> selectEquipmentOverview() { |
| | | return deviceMapper.selectEquipmentOverview(); |
| | | return deviceMapper.selectEquipmentOverview(new com.baomidou.mybatisplus.extension.plugins.pagination.Page(1, 10), QueryWrappers.queryWrappers(new Device())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return deviceMapper.search(status, deviceName, specificationModel, largeCategory); |
| | | } |
| | | |
| | | @Override |
| | | public List<Device> selectDevicePrincipal() { |
| | | return deviceMapper.selectDevicePrincipal(); |
| | | } |
| | | } |
| | | |
| | |
| | | create_time, |
| | | update_user, |
| | | update_time, |
| | | status, |
| | | status |
| | | from device |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | |
| | | <select id="selectEquipmentOverview" resultType="com.yuanchu.mom.pojo.Device"> |
| | | select * from( |
| | | select id, |
| | | deviceName, |
| | | specificationModel, |
| | | deviceStatus, |
| | | device_name, |
| | | specification_model, |
| | | device_status, |
| | | create_user, |
| | | status, |
| | | update_time |
| | |
| | | </select> |
| | | <select id="search" resultType="com.yuanchu.mom.pojo.Device"> |
| | | select * |
| | | from device |
| | | <where> |
| | | <if test="status!=null"> |
| | | and status = #{status} |
| | | </if> |
| | | <if test="deviceName!=null and deviceName!=''"> |
| | | and device_name like concat('%',#{deviceName},'%') |
| | | </if> |
| | | <if test="specificationModel!=null and specificationModel!= ''"> |
| | | and specification_model = #{specificationModel} |
| | | </if> |
| | | <if test="largeCategory!=null and largeCategory!= ''"> |
| | | and large_category = #{largeCategory} |
| | | </if> |
| | | </where> |
| | | from device |
| | | <where> |
| | | <if test="status!=null"> |
| | | and status = #{status} |
| | | </if> |
| | | <if test="deviceName!=null and deviceName!=''"> |
| | | and device_name like concat('%',#{deviceName},'%') |
| | | </if> |
| | | <if test="specificationModel!=null and specificationModel!= ''"> |
| | | and specification_model = #{specificationModel} |
| | | </if> |
| | | <if test="largeCategory!=null and largeCategory!= ''"> |
| | | and large_category = #{largeCategory} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <update id="upDeviceParameter" parameterType="com.yuanchu.mom.pojo.Device"> |
| | | |
| | | UPDATE device |
| | | <set> |
| | | <if test="largeCategory!=null and largeCategory!='' ">large_category=#{largeCategory},</if> |
| | | <if test="dateProduction!=null ">date_production=#{dateProduction},</if> |
| | | <if test="equipmentManager!=null ">equipment_manager=#{equipmentManager},</if> |
| | | <if test="authorizedPerson!=null ">authorized_person=#{authorizedPerson}</if> |
| | | <if test="deviceName!=null ">device_name=#{deviceName}</if> |
| | | <if test="internalCode!=null ">internal_code=#{internalCode}</if> |
| | | <if test="assetCode!=null ">asset_code=#{assetCode}</if> |
| | | <if test="calibrationDate!=null ">calibration_date=#{calibrationDate}</if> |
| | | <if test="scrapTime!=null ">scrap_time=#{scrapTime}</if> |
| | | <if test="acceptanceRecords!=null ">acceptance_records=#{acceptanceRecords}</if> |
| | | <if test="subclass!=null ">subclass=#{subclass}</if> |
| | | <if test="factoryNo!=null ">factory_no=#{factoryNo}</if> |
| | | <if test="acquisitionDate!=null ">create_time=#{acquisition_date}</if> |
| | | <if test="factoryNo!=null ">create_time=#{factory_no}</if> |
| | | <if test="acquisitionDate!=null ">acquisition_date=#{acquisitionDate}</if> |
| | | <if test="accurateMeasurement!=null ">accurate_measurement=#{accurateMeasurement}</if> |
| | | <if test="notes!=null ">notes=#{notes}</if> |
| | | <if test="specificationModel!=null ">specification_model=#{specificationModel}</if> |
| | | <if test="deviceStatus!=null ">device_status=#{deviceStatus}</if> |
| | | <if test="storagePoint!=null ">storage_point=#{storagePoint}</if> |
| | | <if test="latestTraceability!=null ">latest_traceability=#{latestTraceability}</if> |
| | | <if test="downTime!=null ">down_time=#{downTime}</if> |
| | | <if test="maintenanceRecords!=null ">maintenance_records=#{maintenanceRecords}</if> |
| | | <if test="manufacturer!=null ">manufacturer=#{manufacturer}</if> |
| | | <if test="detectionType!=null ">detection_type=#{detectionType}</if> |
| | | <if test="procurementCosts!=null ">procurement_costs=#{procurementCosts}</if> |
| | | <if test="calibrationCerticate!=null ">calibration_certicate=#{calibrationCerticate}</if> |
| | | <if test="status!=null ">status=#{status}</if> |
| | | <if test="imageUpload!=null ">image_upload=#{imageUpload}</if> |
| | | <if test="imageName!=null ">image_name=#{imageName}</if> |
| | | </set> |
| | | <where> |
| | | id=#{id} |
| | | </where> |
| | | </update> |
| | | |
| | | <select id="selectDeviceImage" resultType="com.yuanchu.mom.pojo.Device"> |
| | | select (image_upload, create_user, create_time) values (#{image_upload} |
| | | , #{createUser} |
| | | , #{createTime}) |
| | | </select> |
| | | <select id="selectDevicePrincipal" resultType="com.yuanchu.mom.pojo.Device"> |
| | | select id, |
| | | equipment_manager |
| | | from device |
| | | </select> |
| | | </mapper> |