Commit 7c5bb785 authored by srx's avatar srx

设备管理:筛选,新增,修改,删除,详情

parent d0d167d7
package com.yeejoin.amos.boot.module.ugp.api.mapper; package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment; import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -11,4 +12,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +12,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface AttachmentMapper extends BaseMapper<Attachment> { public interface AttachmentMapper extends BaseMapper<Attachment> {
//根据source_id删除附件
void deleteBySourceId(Long sourceId);
//根据source_id查询附件
AttachmentDto selectAttBySeq(Long sourceId);
} }
package com.yeejoin.amos.boot.module.ugp.api.service; package com.yeejoin.amos.boot.module.ugp.api.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 设备信息表接口类 * 设备信息表接口类
* *
...@@ -8,5 +15,8 @@ package com.yeejoin.amos.boot.module.ugp.api.service; ...@@ -8,5 +15,8 @@ package com.yeejoin.amos.boot.module.ugp.api.service;
* @date 2022-09-22 * @date 2022-09-22
*/ */
public interface IEquipmentService { public interface IEquipmentService {
//添加设备+附件
EquipmentDto saveEI(JSONObject object);
} }
...@@ -2,4 +2,14 @@ ...@@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper"> <mapper namespace="com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper">
<!-- //根据source_id删除附件-->
<delete id="deleteBySourceId">
delete FROM tz_ugp_attachment where source_id=#{sourceId}
</delete>
<!-- //根据source_id查询附件-->
<select id="selectAttBySeq" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto">
select * from tz_ugp_attachment where source_id=#{sourceId}
</select>
</mapper> </mapper>
...@@ -2,11 +2,17 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl; ...@@ -2,11 +2,17 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment; import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService; import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto; import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -26,18 +32,24 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E ...@@ -26,18 +32,24 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@Autowired @Autowired
EquipmentMapper equipmentMapper; EquipmentMapper equipmentMapper;
@Autowired
AttachmentServiceImpl attachmentServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<EquipmentDto> queryForEquipmentPage(Page<EquipmentDto> page) { public Page<EquipmentDto> queryForEquipmentPage(Page<EquipmentDto> page, String name, String code, String verifyStatus) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false,name,code,verifyStatus);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<EquipmentDto> queryForEquipmentList() { public List<EquipmentDto> queryForEquipmentList() {
return this.queryForList("", false); return this.queryForList("" , false);
} }
/** /**
...@@ -62,4 +74,50 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E ...@@ -62,4 +74,50 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
return names; return names;
} }
/**
* 根据sourceId添加附件
* @param object
*/
public void saveAttachment(JSONObject object,Long SequenceNbr){
AttachmentDto attachmentDto = new AttachmentDto();
JSONArray subForm = object.getJSONArray("subForm");
for(Object o:subForm){
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(o));
jsonObject.getString("Symbol_key");
JSONArray jsonArray = jsonObject.getJSONArray("info");
for(Object j:jsonArray){
JSONObject info = JSON.parseObject(JSON.toJSONString(j));
String name = info.getString("name");
attachmentDto.setSourceId(SequenceNbr);
attachmentDto.setName(info.getString("name"));
// attachmentDto.setInfo("name: "+name+","+
// "type: "+name.substring(name.lastIndexOf(".")+1)+","+
// "path: "+info.getString("url")+","+
// "certCode: "+jsonObject.getString("certCode")+","+
// "certType: "+jsonObject.getString("certType"));
attachmentDto.setInfo(JSON.toJSONString(subForm));
attachmentDto.setType(name.substring(name.lastIndexOf(".")+1));
attachmentServiceImpl.createWithModel(attachmentDto);
break;
}
}
}
@Override
public EquipmentDto saveEI(JSONObject object) {
EquipmentDto model = new EquipmentDto();
model.setName(object.getString("name"));
model.setType(object.getString("type"));
model.setCode(object.getString("code"));
model.setManufacturer(object.getString("manufacturer"));
model.setManufactureDate(object.getDate("manufactureDate"));
model.setServiceLife(object.getString("serviceLife"));
model.setInspectionDate(object.getDate("inspectionDate"));
model.setUseStatus(object.getString("useStatus"));
model.setVerifyStatus(object.getString("verifyStatus"));
EquipmentDto result = this.createWithModel(model);
return result;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment