装备管理 youhua
This commit is contained in:
parent
e4d2e7abf8
commit
252136cfeb
|
|
@ -3,6 +3,7 @@ package com.bonus.material.device.mapper;
|
|||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.domain.TypeInfo;
|
||||
import com.bonus.material.device.domain.MaDevQc;
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -86,4 +87,6 @@ public interface BmFileInfoMapper {
|
|||
Integer deleteBmFileInfoByFileId(@Param("fileId") Integer fileId, @Param("fileType") Integer fileType);
|
||||
|
||||
List<BmFileInfo> getInfoByMaIdAndTaskId(MaDevQc qc);
|
||||
|
||||
int insertRentInfo(Ownerdomin ownerdomin);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.bonus.material.owner.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileInfo {
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty(value = "文件 URL")
|
||||
private String fileUrl;
|
||||
}
|
||||
|
|
@ -2,11 +2,13 @@ package com.bonus.material.owner.domain;
|
|||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -58,5 +60,9 @@ public class Ownerdomin {
|
|||
|
||||
private BigDecimal orderCount;
|
||||
|
||||
@ApiModelProperty(value = "文件列表")
|
||||
private List<FileInfo> mainFileList = new ArrayList<>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,4 +18,6 @@ public interface OwnerMapper {
|
|||
Integer del(Ownerdomin ownerdomin);
|
||||
|
||||
List<NewOwnerdomin> listGrouped();
|
||||
|
||||
void deleteFileInfo(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.owner.service.impl;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.bean.BeanUtils;
|
||||
|
|
@ -7,6 +8,8 @@ import com.bonus.common.core.utils.bean.BeanValidators;
|
|||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.dto.DevInfoImpDto;
|
||||
import com.bonus.material.device.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.owner.domain.FileInfo;
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
import com.bonus.material.owner.mapper.OwnerMapper;
|
||||
import com.bonus.material.owner.service.OwnerService;
|
||||
|
|
@ -26,6 +29,9 @@ public class OwnerServiceImpl implements OwnerService {
|
|||
@Resource
|
||||
private OwnerMapper ownerMapper;
|
||||
|
||||
@Resource
|
||||
private BmFileInfoMapper bmFileInfoMapper;
|
||||
|
||||
@Resource
|
||||
protected Validator validator;
|
||||
|
||||
|
|
@ -41,12 +47,27 @@ public class OwnerServiceImpl implements OwnerService {
|
|||
public Integer add(Ownerdomin ownerdomin) {
|
||||
ownerdomin.setCreator(SecurityUtils.getLoginUser().getSysUser().getUserId()+"");
|
||||
ownerdomin.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
return ownerMapper.add(ownerdomin);
|
||||
Integer add = ownerMapper.add(ownerdomin);
|
||||
//判断是否存在图片等
|
||||
if (ownerdomin.getMainFileList() != null && ownerdomin.getMainFileList().size() > 0) {
|
||||
bmFileInfoMapper.insertRentInfo(ownerdomin);
|
||||
}
|
||||
return add;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer edit(Ownerdomin ownerdomin) {
|
||||
return ownerMapper.edit(ownerdomin);
|
||||
Integer edit = ownerMapper.edit(ownerdomin);
|
||||
//删除对应保存到表里面的信息
|
||||
ownerMapper.deleteFileInfo(ownerdomin.getId());
|
||||
if (ownerdomin.getMainFileList() != null && ownerdomin.getMainFileList().size() > 0) {
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
bmFileInfo.setTaskId(Long.valueOf(ownerdomin.getId()));
|
||||
bmFileInfo.setFileName(bmFileInfo.getFileName());
|
||||
bmFileInfo.setFileUrl(bmFileInfo.getFileUrl());
|
||||
bmFileInfoMapper.insertRentInfo(ownerdomin);
|
||||
}
|
||||
return edit;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.device.mapper.BmFileInfoMapper">
|
||||
<resultMap type="com.bonus.common.biz.domain.BmFileInfo" id="BmFileInfoResult">
|
||||
<result property="id" column="id" />
|
||||
|
|
@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileType != null "> and file_type = #{fileType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBmFileInfoById" parameterType="Long" resultMap="BmFileInfoResult">
|
||||
<include refid="selectBmFileInfoVo"/>
|
||||
where model_id = #{id}
|
||||
|
|
@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="getInfoByMaId" resultType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
select
|
||||
id, task_type, task_id, model_id, name as fileName, url as fileUrl, file_type, create_by, create_time
|
||||
id, task_type, task_id, model_id, name as fileName, url as fileUrl, file_type, create_by, create_time
|
||||
from bm_file_info
|
||||
where model_id = #{maId} and file_type = 5 and task_type = 17
|
||||
</select>
|
||||
|
|
@ -67,11 +67,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select
|
||||
id, task_type, task_id, model_id, name fileName, url fileUrl, file_type, create_by, create_time
|
||||
from bm_file_info
|
||||
WHERE
|
||||
WHERE
|
||||
model_id = #{maId}
|
||||
and task_id = #{id}
|
||||
and task_type = 17
|
||||
and file_type = 4
|
||||
and task_id = #{id}
|
||||
and task_type = 17
|
||||
and file_type = 4
|
||||
</select>
|
||||
|
||||
<insert id="insertBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
|
|
@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileType != null">file_type,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="taskType != null">#{taskType},</if>
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
|
|
@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileType != null">#{fileType},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
now()
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertBmFileInfos" parameterType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
|
|
@ -114,6 +114,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertRentInfo" parameterType="com.bonus.material.owner.domain.Ownerdomin">
|
||||
INSERT INTO bm_rent_info(task_id,name,url,create_time)
|
||||
VALUES
|
||||
<foreach collection="mainFileList" item="item" index="index" separator=",">
|
||||
(
|
||||
#{id},
|
||||
#{item.fileName},
|
||||
#{item.fileUrl},
|
||||
now()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
update bm_file_info
|
||||
|
|
@ -135,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<delete id="deleteBmFileInfoByIds" parameterType="String">
|
||||
delete from bm_file_info where id in
|
||||
delete from bm_file_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
|
@ -165,4 +177,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<delete id="deleteBmFileInfoByFileId">
|
||||
delete from bm_file_info where id = #{fileId} and task_type = 17 and file_type = #{fileType}
|
||||
</delete>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,23 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.owner.mapper.OwnerMapper">
|
||||
<insert id="add">
|
||||
<resultMap id="OwnerDominMap" type="com.bonus.material.owner.domain.Ownerdomin">
|
||||
<id property="id" column="id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="maNameId" column="type_id"/>
|
||||
<result property="companyId" column="company_id"/>
|
||||
<result property="maType" column="ma_type"/>
|
||||
<result property="maName" column="type_name"/>
|
||||
<result property="modelId" column="modelId"/>
|
||||
<result property="maModel" column="ma_model"/>
|
||||
<result property="maNum" column="ma_num"/>
|
||||
|
||||
<!-- 嵌套查询附件 -->
|
||||
<collection property="mainFileList" ofType="com.bonus.common.biz.domain.BmFileInfo"
|
||||
select="selectFilesByTaskId" column="id"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="add" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ma_own_manage(
|
||||
ma_type, ma_name, model_id, ma_model, ma_num,
|
||||
creator, remark,company_id,type)
|
||||
|
|
@ -25,23 +41,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
is_active =1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="list" resultType="com.bonus.material.owner.domain.Ownerdomin">
|
||||
<delete id="deleteFileInfo">
|
||||
delete FROM
|
||||
bm_rent_info
|
||||
WHERE
|
||||
task_id = #{id}
|
||||
</delete>
|
||||
<select id="selectFilesByTaskId" resultType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
SELECT
|
||||
id,
|
||||
name AS fileName,
|
||||
url AS fileUrl
|
||||
FROM
|
||||
bm_rent_info
|
||||
WHERE
|
||||
task_id = #{id}
|
||||
</select>
|
||||
<select id="list" resultMap="OwnerDominMap">
|
||||
SELECT
|
||||
m.id,
|
||||
m.type,
|
||||
t.type_id as maNameId,
|
||||
m.company_id as companyId,
|
||||
m.ma_type AS maType,
|
||||
t.type_name AS maName,
|
||||
m.model_id AS modelId,
|
||||
m.ma_model AS maModel,
|
||||
m.ma_num AS maNum,
|
||||
m.create_time AS createTime,
|
||||
m.creator,
|
||||
m.remark
|
||||
t.type_id ,
|
||||
m.company_id,
|
||||
m.ma_type ,
|
||||
t.type_name ,
|
||||
m.model_id ,
|
||||
m.ma_model ,
|
||||
m.ma_num
|
||||
FROM
|
||||
ma_own_manage m
|
||||
ma_own_manage m
|
||||
LEFT JOIN
|
||||
ma_type t ON m.ma_name = t.type_id
|
||||
<where>
|
||||
|
|
|
|||
Loading…
Reference in New Issue