装备质检接口开发,联调

This commit is contained in:
liang.chao 2024-12-09 17:45:05 +08:00
parent 70df292288
commit c58aa96c9f
23 changed files with 221 additions and 48 deletions

View File

@ -96,6 +96,11 @@ public class DevInfoController extends BaseController {
public AjaxResult hotList(DevInfoVo devInfo) { public AjaxResult hotList(DevInfoVo devInfo) {
return devInfoService.selectDevInfoHotList(devInfo); return devInfoService.selectDevInfoHotList(devInfo);
} }
@ApiOperation(value = "关联装备列表")
@GetMapping("/associationList")
public AjaxResult associationList(DevInfoVo devInfo) {
return AjaxResult.success(devInfoService.selectAssociationList(devInfo));
}
/** /**
* 获取设备信息详细信息 * 获取设备信息详细信息

View File

@ -1,5 +1,6 @@
package com.bonus.material.device.controller; package com.bonus.material.device.controller;
import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.device.domain.DevInfo; import com.bonus.material.device.domain.DevInfo;
@ -33,11 +34,23 @@ public class MaDevQcController extends BaseController {
*/ */
@ApiOperation(value = "装备质检列表") @ApiOperation(value = "装备质检列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(@RequestBody MaDevQc maDevQc) { public AjaxResult list(MaDevQc maDevQc) {
startPage(); startPage();
List<MaDevQc> list = maDevQcService.selectDevQcList(maDevQc); List<MaDevQc> list = maDevQcService.selectDevQcList(maDevQc);
return AjaxResult.success(getDataTable(list)); return AjaxResult.success(getDataTable(list));
} }
/**
* 装备质检列表
* @param maDevQc
* @return
*/
@ApiOperation(value = "装备质检列表")
@GetMapping("/qcList")
public AjaxResult qcList(MaDevQc maDevQc) {
startPage();
List<MaDevQc> list = maDevQcService.selectQcList(maDevQc);
return AjaxResult.success(getDataTable(list));
}
/** /**
* 新增装备质检--含附件上传 * 新增装备质检--含附件上传
@ -58,6 +71,10 @@ public class MaDevQcController extends BaseController {
@ApiOperation(value = "删除装备质检") @ApiOperation(value = "删除装备质检")
@PostMapping("/deleteById") @PostMapping("/deleteById")
public AjaxResult deleteById(@RequestBody MaDevQc maDevQc) { public AjaxResult deleteById(@RequestBody MaDevQc maDevQc) {
return maDevQcService.deleteById(maDevQc); if (maDevQc == null || maDevQc.getId() == null) {
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
}
Integer i = maDevQcService.deleteById(maDevQc);
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
} }
} }

View File

@ -249,4 +249,10 @@ public class DevInfo extends BaseEntity {
@ApiModelProperty(value = "校验周期") @ApiModelProperty(value = "校验周期")
private Integer checkCycle; private Integer checkCycle;
@ApiModelProperty(value = "是否上传质检证书0否 1")
private Integer isQc;
@ApiModelProperty(value = "是否上传安全证书0否 1")
private Integer isSafeBook;
} }

View File

@ -60,5 +60,15 @@ public class MaDevQc extends BaseEntity implements Serializable {
@ApiModelProperty(value = "附件信息") @ApiModelProperty(value = "附件信息")
private List<BmFileInfo> fileInfoList; private List<BmFileInfo> fileInfoList;
@ApiModelProperty(value = "附件地址")
private String url;
@ApiModelProperty(value = "上传人")
private String nickName;
@ApiModelProperty(value = "质检次数")
private Integer minNum;
private Integer maxNum;
} }

View File

@ -1,10 +1,12 @@
package com.bonus.material.device.domain; package com.bonus.material.device.domain;
import com.bonus.common.biz.domain.BmFileInfo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Authorliang.chao * @Authorliang.chao
@ -21,9 +23,6 @@ public class SafeBookInfo {
@ApiModelProperty(value = "关联装备") @ApiModelProperty(value = "关联装备")
private Integer maId; private Integer maId;
@ApiModelProperty(value = "证书附件")
private String url;
@ApiModelProperty(value = "上传人Id") @ApiModelProperty(value = "上传人Id")
private Long uploadPerson; private Long uploadPerson;
@ -38,4 +37,7 @@ public class SafeBookInfo {
private String startTime; private String startTime;
private String endTime; private String endTime;
@ApiModelProperty(value = "安全证书附件")
private List<BmFileInfo> fileInfoList;
} }

View File

@ -8,6 +8,7 @@ import java.util.List;
/** /**
* 附件Mapper接口 * 附件Mapper接口
*
* @author xsheng * @author xsheng
*/ */
public interface BmFileInfoMapper { public interface BmFileInfoMapper {
@ -17,7 +18,7 @@ public interface BmFileInfoMapper {
* @param id 附件主键 * @param id 附件主键
* @return 附件 * @return 附件
*/ */
List<BmFileInfo> selectBmFileInfoById(Long id); List<BmFileInfo> selectBmFileInfoById(Long id);
/** /**
* 查询附件列表 * 查询附件列表
@ -55,7 +56,6 @@ public interface BmFileInfoMapper {
/** /**
* 批量删除附件 * 批量删除附件
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
@ -72,4 +72,6 @@ public interface BmFileInfoMapper {
int deleteBmFileInfoByBizInfo(BmFileInfo bmFileInfo); int deleteBmFileInfoByBizInfo(BmFileInfo bmFileInfo);
TypeInfo getTypeInfo(String deviceName); TypeInfo getTypeInfo(String deviceName);
Integer deleteBmFileInfoByMaId(@Param("maId") Integer maId, @Param("fileType") Integer fileType);
} }

View File

@ -4,6 +4,8 @@ package com.bonus.material.device.mapper;
import com.bonus.common.biz.domain.*; import com.bonus.common.biz.domain.*;
import com.bonus.material.book.domain.BookCarInfoDto; import com.bonus.material.book.domain.BookCarInfoDto;
import com.bonus.material.device.domain.DevInfo; import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.MaDevQc;
import com.bonus.material.device.domain.SafeBookInfo;
import com.bonus.material.device.domain.dto.InfoMotionDto; import com.bonus.material.device.domain.dto.InfoMotionDto;
import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.domain.vo.DevInfoVo;
import com.bonus.material.device.domain.vo.LeaseVo; import com.bonus.material.device.domain.vo.LeaseVo;
@ -167,5 +169,10 @@ public interface DevInfoMapper {
DevInfoVo selectCompanyById(String companyId); DevInfoVo selectCompanyById(String companyId);
String getCodeByMaId(Long maId); String getCodeByMaId(Long maId);
Integer updateDevInfoIsQc(MaDevQc maDevQc);
Integer updateDevInfoIsSafeBook(SafeBookInfo safeBookInfo);
List<DevInfoVo> selectAssociationList(DevInfoVo devInfo);
} }

View File

@ -41,4 +41,6 @@ public interface MaDevQcMapper {
* @return * @return
*/ */
String selectTaskNumByMonth(Date nowDate); String selectTaskNumByMonth(Date nowDate);
List<MaDevQc> selectQcList(MaDevQc maDevQc);
} }

View File

@ -103,4 +103,6 @@ public interface DevInfoService {
String importMaProp(List<DevInfoImpDto> maPropInfoList, boolean updateSupport, Long operName); String importMaProp(List<DevInfoImpDto> maPropInfoList, boolean updateSupport, Long operName);
void downLoadTemplate(HttpServletResponse resp); void downLoadTemplate(HttpServletResponse resp);
List<DevInfoVo> selectAssociationList(DevInfoVo devInfo);
} }

View File

@ -30,5 +30,7 @@ public interface MaDevQcService {
* @param maDevQc * @param maDevQc
* @return * @return
*/ */
AjaxResult deleteById(MaDevQc maDevQc); Integer deleteById(MaDevQc maDevQc);
List<MaDevQc> selectQcList(MaDevQc maDevQc);
} }

View File

@ -667,6 +667,12 @@ public class DevInfoServiceImpl implements DevInfoService {
} }
} }
@Override
public List<DevInfoVo> selectAssociationList(DevInfoVo devInfo) {
devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
return devInfoMapper.selectAssociationList(devInfo);
}
@Override @Override
public void insertOutType(String devInfo) { public void insertOutType(String devInfo) {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();

View File

@ -9,6 +9,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.device.domain.MaDevQc; import com.bonus.material.device.domain.MaDevQc;
import com.bonus.material.device.mapper.BmFileInfoMapper; import com.bonus.material.device.mapper.BmFileInfoMapper;
import com.bonus.material.device.mapper.DevInfoMapper;
import com.bonus.material.device.mapper.MaDevQcMapper; import com.bonus.material.device.mapper.MaDevQcMapper;
import com.bonus.material.device.service.MaDevQcService; import com.bonus.material.device.service.MaDevQcService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -32,8 +33,12 @@ public class MaDevQcServiceImpl implements MaDevQcService {
@Resource @Resource
private BmFileInfoMapper bmFileInfoMapper; private BmFileInfoMapper bmFileInfoMapper;
@Resource
private DevInfoMapper devInfoMapper;
/** /**
* 装备质检列表 * 装备质检列表
*
* @param maDevQc * @param maDevQc
* @return * @return
*/ */
@ -44,6 +49,7 @@ public class MaDevQcServiceImpl implements MaDevQcService {
/** /**
* 新增装备质检 * 新增装备质检
*
* @param maDevQc * @param maDevQc
* @return * @return
*/ */
@ -57,12 +63,16 @@ public class MaDevQcServiceImpl implements MaDevQcService {
maDevQc.setCreateBy(String.valueOf(SecurityUtils.getUserId())); maDevQc.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
maDevQc.setCreateTime(DateUtils.getNowDate()); maDevQc.setCreateTime(DateUtils.getNowDate());
int result = maDevQcMapper.insertDevQc(maDevQc); int result = maDevQcMapper.insertDevQc(maDevQc);
devInfoMapper.updateDevInfoIsQc(maDevQc);
if (result > 0 && maDevQc.getId() != null) { if (result > 0 && maDevQc.getId() != null) {
if (CollectionUtils.isNotEmpty(maDevQc.getFileInfoList())) { if (CollectionUtils.isNotEmpty(maDevQc.getFileInfoList())) {
for (BmFileInfo bmFileInfo : maDevQc.getFileInfoList()) { for (BmFileInfo bmFileInfo : maDevQc.getFileInfoList()) {
bmFileInfo.setModelId(Long.valueOf(maDevQc.getId())); bmFileInfo.setTaskId(Long.valueOf(maDevQc.getId()));
bmFileInfo.setModelId(Long.valueOf(maDevQc.getMaId()));
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE); bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
// 质检附件
bmFileInfo.setFileType(4L); bmFileInfo.setFileType(4L);
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo); bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
} }
} }
@ -72,6 +82,7 @@ public class MaDevQcServiceImpl implements MaDevQcService {
/** /**
* 生成需求编号 * 生成需求编号
*
* @return * @return
*/ */
private String getString() { private String getString() {
@ -90,20 +101,26 @@ public class MaDevQcServiceImpl implements MaDevQcService {
} else { } else {
taskNum = "0001"; taskNum = "0001";
} }
return "QC" + format + "-" + taskNum; return "WXBY" + format + "-" + taskNum;
} }
/** /**
* 删除装备质检 * 删除装备质检
*
* @param maDevQc * @param maDevQc
* @return * @return
*/ */
@Override @Override
public AjaxResult deleteById(MaDevQc maDevQc) { public Integer deleteById(MaDevQc maDevQc) {
if (maDevQc == null || maDevQc.getId() == null) { int i = maDevQcMapper.deleteDevQcById(maDevQc.getId());
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg()); if (i > 0) {
bmFileInfoMapper.deleteBmFileInfoByMaId(maDevQc.getId(),4);
} }
return maDevQcMapper.deleteDevQcById(maDevQc.getId()) > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : return i;
AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); }
@Override
public List<MaDevQc> selectQcList(MaDevQc maDevQc) {
return maDevQcMapper.selectQcList(maDevQc);
} }
} }

View File

@ -1,10 +1,15 @@
package com.bonus.material.device.service.impl; package com.bonus.material.device.service.impl;
import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.device.domain.SafeBookInfo; import com.bonus.material.device.domain.SafeBookInfo;
import com.bonus.material.device.mapper.BmFileInfoMapper;
import com.bonus.material.device.mapper.DevInfoMapper;
import com.bonus.material.device.mapper.SafeBookMapper; import com.bonus.material.device.mapper.SafeBookMapper;
import com.bonus.material.device.service.SafeBookService; import com.bonus.material.device.service.SafeBookService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -22,6 +27,12 @@ public class SafeBookServiceImpl implements SafeBookService {
@Resource @Resource
private SafeBookMapper safeBookMapper; private SafeBookMapper safeBookMapper;
@Resource
private BmFileInfoMapper bmFileInfoMapper;
@Resource
private DevInfoMapper devInfoMapper;
@Override @Override
public List<SafeBookInfo> getSafeBookByMaId(SafeBookInfo safeBookInfo) { public List<SafeBookInfo> getSafeBookByMaId(SafeBookInfo safeBookInfo) {
return safeBookMapper.getSafeBookByMaId(safeBookInfo); return safeBookMapper.getSafeBookByMaId(safeBookInfo);
@ -31,12 +42,30 @@ public class SafeBookServiceImpl implements SafeBookService {
public Integer addSafeBook(SafeBookInfo safeBookInfo) { public Integer addSafeBook(SafeBookInfo safeBookInfo) {
safeBookInfo.setCode(getString()); safeBookInfo.setCode(getString());
safeBookInfo.setUploadPerson(SecurityUtils.getLoginUser().getUserid()); safeBookInfo.setUploadPerson(SecurityUtils.getLoginUser().getUserid());
return safeBookMapper.addSafeBook(safeBookInfo); Integer i = safeBookMapper.addSafeBook(safeBookInfo);
devInfoMapper.updateDevInfoIsSafeBook(safeBookInfo);
if (i > 0){
if (CollectionUtils.isNotEmpty(safeBookInfo.getFileInfoList())) {
for (BmFileInfo bmFileInfo : safeBookInfo.getFileInfoList()) {
bmFileInfo.setModelId(safeBookInfo.getId().longValue());
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
// 安全证书附件
bmFileInfo.setFileType(5L);
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}
}
}
return i;
} }
@Override @Override
public Integer delSafeBook(SafeBookInfo safeBookInfo) { public Integer delSafeBook(SafeBookInfo safeBookInfo) {
return safeBookMapper.delSafeBook(safeBookInfo); Integer i = safeBookMapper.delSafeBook(safeBookInfo);
if (i > 0){
bmFileInfoMapper.deleteBmFileInfoByMaId(safeBookInfo.getMaId(),5);
}
return i;
} }
private String getString() { private String getString() {

View File

@ -255,11 +255,14 @@ public class MaTypeController extends BaseController {
@ApiOperation(value = "租赁价(批量)修改") @ApiOperation(value = "租赁价(批量)修改")
@PostMapping("/updateLeasePrice") @PostMapping("/updateLeasePrice")
public AjaxResult updateLeasePrice(@RequestBody List<Integer> typeIds) { public AjaxResult updateLeasePrice(@RequestBody MaType maType) {
if (typeIds.isEmpty()) { if (maType.getTypeIds().isEmpty()) {
return AjaxResult.error("请选择要修改的机具"); return AjaxResult.error("请选择要修改的机具");
} }
Integer i = iTypeService.updateLeasePrice(typeIds); if (maType.getLeasePrice() == null) {
return AjaxResult.error("请输入价格");
}
Integer i = iTypeService.updateLeasePrice(maType);
if (i > 0){ if (i > 0){
return AjaxResult.success("修改成功"); return AjaxResult.success("修改成功");
}else { }else {

View File

@ -4,6 +4,7 @@ import com.bonus.material.ma.vo.*;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -85,5 +86,5 @@ public interface MaTypeMapper {
List<Integer> selectParentId(@Param("typeId")Long typeId, @Param("level")Integer level); List<Integer> selectParentId(@Param("typeId")Long typeId, @Param("level")Integer level);
Integer updateLeasePrice(@Param("typeIds")List<Integer> typeIds); Integer updateLeasePrice(@Param("typeIds")List<Integer> typeIds,@Param("leasePrice") BigDecimal leasePrice);
} }

View File

@ -68,5 +68,5 @@ public interface ITypeService {
List<MaType> getEquipmentType(Long typeId, String typeName); List<MaType> getEquipmentType(Long typeId, String typeName);
Integer updateLeasePrice(List<Integer> typeIds); Integer updateLeasePrice(MaType typeIds);
} }

View File

@ -372,8 +372,8 @@ public class MaTypeServiceImpl implements ITypeService {
} }
@Override @Override
public Integer updateLeasePrice(List<Integer> typeIds) { public Integer updateLeasePrice(MaType maType) {
return maTypeMapper.updateLeasePrice(typeIds); return maTypeMapper.updateLeasePrice(maType.getTypeIds(), maType.getLeasePrice());
} }
/** /**

View File

@ -214,4 +214,6 @@ public class MaType extends BaseEntity {
* */ * */
@ApiModelProperty(value = "推送智慧工程定义的门类分类机具编码") @ApiModelProperty(value = "推送智慧工程定义的门类分类机具编码")
private String intelligentCode; private String intelligentCode;
private List<Integer> typeIds;
} }

View File

@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileName != null">`name`,</if> <if test="fileName != null">`name`,</if>
<if test="fileUrl != null">url,</if> <if test="fileUrl != null">url,</if>
<if test="fileType != null">file_type,</if> <if test="fileType != null">file_type,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileName != null">#{fileName},</if> <if test="fileName != null">#{fileName},</if>
<if test="fileUrl != null">#{fileUrl},</if> <if test="fileUrl != null">#{fileUrl},</if>
<if test="fileType != null">#{fileType},</if> <if test="fileType != null">#{fileType},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
now() now()
</trim> </trim>
</insert> </insert>
@ -118,4 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileType != null "> and file_type = #{fileType}</if> <if test="fileType != null "> and file_type = #{fileType}</if>
</where> </where>
</delete> </delete>
<delete id="deleteBmFileInfoByMaId">
delete from bm_file_info where model_id = #{maId} and task_type = 17 and file_type = #{fileType}
</delete>
</mapper> </mapper>

View File

@ -455,6 +455,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="upMaStatus"> <update id="upMaStatus">
update ma_dev_info set ma_status = #{maStatus} where ma_id = #{maId} and is_active = 1 update ma_dev_info set ma_status = #{maStatus} where ma_id = #{maId} and is_active = 1
</update> </update>
<update id="updateDevInfoIsQc">
update ma_dev_info set is_qc = 1 where ma_id = #{maId} and is_active = 1
</update>
<update id="updateDevInfoIsSafeBook">
update ma_dev_info set is_safe_book = 1 where ma_id = #{maId} and is_active = 1
</update>
<select id="getSysDic" resultType="com.bonus.common.biz.domain.SysDic"> <select id="getSysDic" resultType="com.bonus.common.biz.domain.SysDic">
select select
@ -690,5 +696,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select ma_id from ma_dev_info select ma_id from ma_dev_info
where device_name = #{deviceName,jdbcType=VARCHAR} and is_active = '1' where device_name = #{deviceName,jdbcType=VARCHAR} and is_active = '1'
</select> </select>
<select id="selectAssociationList" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
select
d.*,
mt4.type_name as typeName,mt4.unit_name as unitName,
mt3.type_id as thirdId,mt3.type_name as thirdName,
mt2.type_id as secondId,mt2.type_name as secondName,
mt1.type_id as firstId,mt1.type_name as firstName
from
ma_dev_info d
left join ma_type mt4 ON mt4.type_id = d.type_id and mt4.del_flag = '0'
left join ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
left join ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
left join ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
where
d.ma_status != 0
and d.is_active = '1'
and d.own_co = #{companyId}
ORDER BY d.create_time desc
</select>
</mapper> </mapper>

View File

@ -32,34 +32,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert> </insert>
<select id="selectTaskNumByMonth" resultType="java.lang.String"> <select id="selectTaskNumByMonth" resultType="java.lang.String">
SELECT SUBSTRING(code, - 4) as code SELECT SUBSTRING(qc_code, - 4) as code
FROM ma_dev_qc FROM ma_dev_qc
WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m') WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
ORDER BY create_time DESC LIMIT 1 ORDER BY create_time DESC LIMIT 1
</select> </select>
<select id="selectDevQcList" resultType="com.bonus.material.device.domain.MaDevQc"> <select id="selectDevQcList" resultType="com.bonus.material.device.domain.MaDevQc">
select SELECT
m1.id, m1.id,
m1.ma_id as maId, m1.ma_id AS maId,
m2.device_code as deviceCode, m2.CODE AS deviceCode,
m2.device_name as deviceName, m2.device_name AS deviceName,
m1.qc_name as qcName, m1.qc_name AS qcName,
m1.qc_code as qcCode, m1.qc_code AS qcCode,
m1.qc_user as qcUser, m1.qc_user AS qcUser,
m1.qc_time as qcTime, m1.qc_time AS qcTime,
su.nick_name as createBy, su.nick_name AS createBy,
m1.create_time as createTime m1.create_time AS createTime
from ma_dev_qc m1 FROM
left join ma_dev_info m2 on m1.ma_id = m2.ma_id and m2.is_active = '1' ma_dev_qc m1
left join sys_user su on su.user_id = m1.create_by LEFT JOIN ma_dev_info m2 ON m1.ma_id = m2.ma_id
AND m2.is_active = '1'
LEFT JOIN sys_user su ON su.user_id = m1.create_by
INNER JOIN ( SELECT count(*) as num, ma_id, MAX( qc_time ) AS max_qc_time FROM ma_dev_qc GROUP BY ma_id ) latest_qc ON m1.ma_id = latest_qc.ma_id
AND m1.qc_time = latest_qc.max_qc_time
<where> <where>
<if test="deviceCode != null and deviceCode != ''"> <if test="deviceCode != null and deviceCode != ''">
and m2.device_code like concat('%',#{deviceCode},'%') and m2.code like concat('%',#{deviceCode},'%')
</if> </if>
<if test="qcUser != null and qcUser != ''"> <if test="qcUser != null and qcUser != ''">
and m1.qc_user like concat('%',#{qcUser},'%') and m1.qc_user like concat('%',#{qcUser},'%')
</if> </if>
<if test="minNum != null and maxNum != ''">
and latest_qc.num BETWEEN #{minNum} AND #{maxNum}
</if>
<if test="qcCode != null and qcCode != ''"> <if test="qcCode != null and qcCode != ''">
and m1.qc_code like concat('%',#{qcCode},'%') and m1.qc_code like concat('%',#{qcCode},'%')
</if> </if>
@ -67,9 +74,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(m1.qc_time,'%Y-%m-%d') between #{qcStartTime} and #{qcEndTime} and DATE_FORMAT(m1.qc_time,'%Y-%m-%d') between #{qcStartTime} and #{qcEndTime}
</if> </if>
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''"> <if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime} and DATE_FORMAT(m1.update_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
</if> </if>
</where> </where>
ORDER BY
m1.qc_time DESC
</select>
<select id="selectQcList" resultType="com.bonus.material.device.domain.MaDevQc">
SELECT
mdq.*,
su.nick_name AS nickName,
bfi.url AS url
FROM
ma_dev_qc mdq
LEFT JOIN bm_file_info bfi ON bfi.model_id = mdq.ma_id
LEFT JOIN sys_user su ON mdq.create_by = su.user_id
WHERE
bfi.task_type = 17
AND bfi.file_type = 4
AND bfi.task_id = #{id}
<if test="qcCode != null and qcCode != ''">
and mdq.qc_code like concat('%',#{qcCode},'%')
</if>
<if test="qcStartTime != null and qcStartTime != '' and qcEndTime != null and qcEndTime != ''">
and DATE_FORMAT(mdq.qc_time,'%Y-%m-%d') between #{qcStartTime} and #{qcEndTime}
</if>
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
and DATE_FORMAT(mdq.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
</if>
</select> </select>
</mapper> </mapper>

View File

@ -3,9 +3,9 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.device.mapper.SafeBookMapper"> <mapper namespace="com.bonus.material.device.mapper.SafeBookMapper">
<insert id="addSafeBook"> <insert id="addSafeBook" useGeneratedKeys="true" keyProperty="id">
insert into safe_book(code,ma_id,url,upload_person,create_time) insert into safe_book(code,ma_id,upload_person,create_time)
values(#{code},#{maId},#{url},#{uploadPerson},now()) values(#{code},#{maId},#{uploadPerson},now())
</insert> </insert>
<delete id="delSafeBook"> <delete id="delSafeBook">

View File

@ -163,7 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type mt ON mdi.type_id = mt.type_id left join ma_type mt ON mdi.type_id = mt.type_id
AND bfi.file_type = 0 AND bfi.file_type = 0
WHERE WHERE
hh.id = #{id} and bfi.task_type = 17 limit 1 hh.id = #{id} and bfi.task_type = 17 and bfi.file_type = 0 limit 1
</select> </select>
<select id="getOrderDetailsById" resultType="com.bonus.material.order.domain.OrderInfoDto"> <select id="getOrderDetailsById" resultType="com.bonus.material.order.domain.OrderInfoDto">
SELECT SELECT
@ -242,7 +242,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
AND bfi.file_type = 0 AND bfi.file_type = 0
WHERE WHERE
moi.order_id = #{orderId} and bfi.task_type = 17 moi.order_id = #{orderId} and bfi.task_type = 17 and bfi.file_type = 0
GROUP BY hh.ma_id GROUP BY hh.ma_id
</select> </select>
<select id="getOrderDetailsByOrderId" resultType="com.bonus.material.order.domain.OrderDetailDto"> <select id="getOrderDetailsByOrderId" resultType="com.bonus.material.order.domain.OrderDetailDto">