This commit is contained in:
parent
f707f0d06f
commit
5a787c9de0
|
|
@ -9,4 +9,7 @@ public class TypeConstants {
|
||||||
|
|
||||||
/** 领料单号的开头字母 */
|
/** 领料单号的开头字母 */
|
||||||
public static final String LEASE_TASK_TYPE_LABEL = "L";
|
public static final String LEASE_TASK_TYPE_LABEL = "L";
|
||||||
|
|
||||||
|
/** 维修单号的开头字母 */
|
||||||
|
public static final String REPAIR_TASK_TYPE_LABEL = "W";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,14 @@ public class CsDeviceInfo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "结束时间")
|
@ApiModelProperty(value = "结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核状态
|
||||||
|
*/
|
||||||
|
private String reviewStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.bonus.material.repair.controller;
|
||||||
|
|
||||||
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.devchange.domain.CsDeviceInfo;
|
||||||
|
import com.bonus.material.devchange.domain.CsDeviceVo;
|
||||||
import com.bonus.material.repair.domain.ToBeRepair;
|
import com.bonus.material.repair.domain.ToBeRepair;
|
||||||
import com.bonus.material.repair.service.RepairService;
|
import com.bonus.material.repair.service.RepairService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -37,4 +39,49 @@ public class RepairController extends BaseController {
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修申请
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增维修申请")
|
||||||
|
@PostMapping("/addRepairData")
|
||||||
|
public AjaxResult addRepairData(@RequestBody ToBeRepair bean) {
|
||||||
|
return service.addRepairData(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询维修列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询维修列表")
|
||||||
|
@GetMapping("/getRepairList")
|
||||||
|
public AjaxResult getRepairList(ToBeRepair bean)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ToBeRepair> list = service.getRepairList(bean);
|
||||||
|
return AjaxResult.success(getDataTable(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除维修列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除维修列表")
|
||||||
|
@PostMapping("/deleteRepairList")
|
||||||
|
public AjaxResult deleteRepairList(@RequestBody ToBeRepair bean) {
|
||||||
|
return service.deleteRepairList(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修详情列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "维修详情列表")
|
||||||
|
@GetMapping("/getRepairDetailsList")
|
||||||
|
public AjaxResult getRepairDetailsList(ToBeRepair bean)
|
||||||
|
{
|
||||||
|
List<ToBeRepair> list = service.getRepairDetailsList(bean);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package com.bonus.material.repair.domain;
|
package com.bonus.material.repair.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.BmFileInfo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hay
|
* @author hay
|
||||||
|
|
@ -12,6 +14,8 @@ public class ToBeRepair {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
private Long changeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用作key
|
* 用作key
|
||||||
*/
|
*/
|
||||||
|
|
@ -22,6 +26,16 @@ public class ToBeRepair {
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型id
|
||||||
|
*/
|
||||||
|
private String typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型 1-装备,2-工具
|
||||||
|
*/
|
||||||
|
private String devType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类目
|
* 类目
|
||||||
*/
|
*/
|
||||||
|
|
@ -56,4 +70,62 @@ public class ToBeRepair {
|
||||||
* 维修数量
|
* 维修数量
|
||||||
*/
|
*/
|
||||||
private BigDecimal repairNum;
|
private BigDecimal repairNum;
|
||||||
|
|
||||||
|
private String repairUrl;
|
||||||
|
private String scrapUrl;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否报废
|
||||||
|
*/
|
||||||
|
private String isScrap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修时间
|
||||||
|
*/
|
||||||
|
private String repairTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退役原因
|
||||||
|
*/
|
||||||
|
private String reasonVal;
|
||||||
|
private List<BmFileInfo> bmFileInfos;
|
||||||
|
|
||||||
|
private List<ToBeRepair> toBeRepairList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装备数
|
||||||
|
*/
|
||||||
|
private BigDecimal equipmentNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具数
|
||||||
|
*/
|
||||||
|
private BigDecimal toolNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private String endTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.material.repair.mapper;
|
package com.bonus.material.repair.mapper;
|
||||||
|
|
||||||
|
import com.bonus.material.devchange.domain.CsDeviceInfo;
|
||||||
import com.bonus.material.repair.domain.ToBeRepair;
|
import com.bonus.material.repair.domain.ToBeRepair;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -12,4 +14,55 @@ public interface RepairMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ToBeRepair> selectToBeRepairList(ToBeRepair bean);
|
List<ToBeRepair> selectToBeRepairList(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取申请编号
|
||||||
|
* @param year
|
||||||
|
* @param month
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month, @Param("type") Integer type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param deviceInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int addDeviceChange(CsDeviceInfo deviceInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备详情
|
||||||
|
* @param toBeRepair
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int addRepairData(ToBeRepair toBeRepair);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ToBeRepair> getRepairList(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备变更信息
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int deleteChangeInfo(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备详情信息
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int deleteChangeDetails(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备详情列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ToBeRepair> getRepairDetailsList(ToBeRepair bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.material.repair.service;
|
package com.bonus.material.repair.service;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.repair.domain.ToBeRepair;
|
import com.bonus.material.repair.domain.ToBeRepair;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -14,4 +15,32 @@ public interface RepairService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ToBeRepair> getToBeRepairList(ToBeRepair bean);
|
List<ToBeRepair> getToBeRepairList(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修数据
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult addRepairData(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ToBeRepair> getRepairList(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除维修数据
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult deleteRepairList(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修详情列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ToBeRepair> getRepairDetailsList(ToBeRepair bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,24 @@
|
||||||
package com.bonus.material.repair.service.impl;
|
package com.bonus.material.repair.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.material.common.constants.TypeConstants;
|
||||||
|
import com.bonus.material.common.enums.TypeEnums;
|
||||||
|
import com.bonus.material.devchange.domain.CsDeviceInfo;
|
||||||
import com.bonus.material.repair.domain.ToBeRepair;
|
import com.bonus.material.repair.domain.ToBeRepair;
|
||||||
import com.bonus.material.repair.mapper.RepairMapper;
|
import com.bonus.material.repair.mapper.RepairMapper;
|
||||||
import com.bonus.material.repair.service.RepairService;
|
import com.bonus.material.repair.service.RepairService;
|
||||||
|
import org.hibernate.validator.internal.util.StringHelper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -20,6 +31,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
@Resource
|
@Resource
|
||||||
private RepairMapper mapper;
|
private RepairMapper mapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ToBeRepair> getToBeRepairList(ToBeRepair bean) {
|
public List<ToBeRepair> getToBeRepairList(ToBeRepair bean) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -29,4 +41,110 @@ public class RepairServiceImpl implements RepairService {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult addRepairData(ToBeRepair bean) {
|
||||||
|
try {
|
||||||
|
if (bean.getToBeRepairList().size() <= 0) {
|
||||||
|
return AjaxResult.error("请添加维修数据");
|
||||||
|
}
|
||||||
|
String username = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||||
|
//先创建任务--台账变更表
|
||||||
|
//1、创建维修单号
|
||||||
|
int thisMonthMaxOrder = mapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TypeEnums.TM_TASK_REPAIR.getTaskTypeId());
|
||||||
|
String code = genderTaskCode(thisMonthMaxOrder);
|
||||||
|
CsDeviceInfo deviceInfo = new CsDeviceInfo();
|
||||||
|
deviceInfo.setType("4");
|
||||||
|
deviceInfo.setCode(code);
|
||||||
|
deviceInfo.setReviewStatus("0");
|
||||||
|
deviceInfo.setCreateUser(username);
|
||||||
|
// 添加任务
|
||||||
|
int num = mapper.addDeviceChange(deviceInfo);
|
||||||
|
if (num < 1) {
|
||||||
|
throw new Exception("添加任务失败");
|
||||||
|
}
|
||||||
|
Long changeId = deviceInfo.getId();
|
||||||
|
for (ToBeRepair toBeRepair : bean.getToBeRepairList()) {
|
||||||
|
toBeRepair.setChangeId(changeId);
|
||||||
|
toBeRepair.setCreateUser(username);
|
||||||
|
if (!StringHelper.isNullOrEmptyString(toBeRepair.getIsScrap())) {
|
||||||
|
if (toBeRepair.getBmFileInfos()!=null && toBeRepair.getBmFileInfos().size() > 0) {
|
||||||
|
if ("0".equals(toBeRepair.getIsScrap())) {
|
||||||
|
toBeRepair.setRepairUrl(toBeRepair.getBmFileInfos().get(0).getFileUrl());
|
||||||
|
} else {
|
||||||
|
toBeRepair.setScrapUrl(toBeRepair.getBmFileInfos().get(0).getFileUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Exception("缺少合格状态数据");
|
||||||
|
}
|
||||||
|
int res = mapper.addRepairData(toBeRepair);
|
||||||
|
if (res <= 0) {
|
||||||
|
throw new Exception("添加设备详情失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success("申请成功");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return AjaxResult.error("申请失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ToBeRepair> getRepairList(ToBeRepair bean) {
|
||||||
|
try {
|
||||||
|
return mapper.getRepairList(bean);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult deleteRepairList(ToBeRepair bean) {
|
||||||
|
try {
|
||||||
|
//删除主任务
|
||||||
|
int num = mapper.deleteChangeInfo(bean);
|
||||||
|
if (num < 1) {
|
||||||
|
throw new Exception("删除主任务失败");
|
||||||
|
}
|
||||||
|
//删除设备详情
|
||||||
|
num = mapper.deleteChangeDetails(bean);
|
||||||
|
if (num < 1) {
|
||||||
|
throw new Exception("删除设备详情失败");
|
||||||
|
}
|
||||||
|
return AjaxResult.success("删除成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return AjaxResult.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ToBeRepair> getRepairDetailsList(ToBeRepair bean) {
|
||||||
|
try {
|
||||||
|
return mapper.getRepairDetailsList(bean);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成任务编号
|
||||||
|
* @param thisMonthMaxOrder
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String genderTaskCode(int thisMonthMaxOrder) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date nowDate = DateUtils.getNowDate();
|
||||||
|
String format = dateFormat.format(nowDate);
|
||||||
|
String result = format.replace("-", "");
|
||||||
|
return TypeConstants.REPAIR_TASK_TYPE_LABEL + result + String.format("-%04d", thisMonthMaxOrder + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,59 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?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" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="com.bonus.material.repair.mapper.RepairMapper">
|
<mapper namespace="com.bonus.material.repair.mapper.RepairMapper">
|
||||||
|
<insert id="addDeviceChange" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into cs_device_change(type, code, review_status, create_user, create_time, del_flag)
|
||||||
|
values (#{type}, #{code}, #{reviewStatus}, #{createUser}, NOW(), '0')
|
||||||
|
</insert>
|
||||||
|
<insert id="addRepairData">
|
||||||
|
insert into cs_device_change_details(
|
||||||
|
change_id,
|
||||||
|
<if test="code != null and code!=''">dev_code,</if>
|
||||||
|
<if test="typeId != null and typeId!=''">dev_type_id,</if>
|
||||||
|
<if test="devType != null and devType!=''">dev_type,</if>
|
||||||
|
<if test="repairNum != null">num,</if>
|
||||||
|
<if test="repairNum != null">real_num,</if>
|
||||||
|
<if test="createUser != null">repairman,</if>
|
||||||
|
<if test="repairTime != null and repairTime!=''">repair_time,</if>
|
||||||
|
<if test="repairUrl != null and repairUrl!=''">repair_url,</if>
|
||||||
|
<if test="reasonVal != null and reasonVal!=''">reason_val,</if>
|
||||||
|
<if test="scrapUrl != null and scrapUrl!=''">reason_url,</if>
|
||||||
|
<if test="isScrap != null and isScrap!=''">is_scrap,</if>
|
||||||
|
<if test="createUser != null">create_user,</if>
|
||||||
|
create_time
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
#{changeId},
|
||||||
|
<if test="code != null and code!=''">#{code},</if>
|
||||||
|
<if test="typeId != null and typeId!=''">#{typeId},</if>
|
||||||
|
<if test="devType != null and devType!=''">#{devType},</if>
|
||||||
|
<if test="repairNum != null">#{repairNum},</if>
|
||||||
|
<if test="repairNum != null">#{repairNum},</if>
|
||||||
|
<if test="createUser != null">#{createUser},</if>
|
||||||
|
<if test="repairTime != null and repairTime!=''">#{repairTime},</if>
|
||||||
|
<if test="repairUrl != null and repairUrl!=''">#{repairUrl},</if>
|
||||||
|
<if test="reasonVal != null and reasonVal!=''">#{reasonVal},</if>
|
||||||
|
<if test="scrapUrl != null and scrapUrl!=''">#{scrapUrl},</if>
|
||||||
|
<if test="isScrap != null and isScrap!=''">#{isScrap},</if>
|
||||||
|
<if test="createUser != null">#{createUser},</if>
|
||||||
|
NOW()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="deleteChangeInfo">
|
||||||
|
update cs_device_change set del_flag = '1' where id = #{id}
|
||||||
|
</update>
|
||||||
|
<update id="deleteChangeDetails">
|
||||||
|
update cs_device_change_details set del_flag = '1' where change_id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="selectToBeRepairList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
<select id="selectToBeRepairList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
||||||
SELECT
|
SELECT
|
||||||
CONCAT(tl.id,'-','工具') as keyId,
|
CONCAT(tl.id,'-','工具') as keyId,
|
||||||
tl.id,
|
tl.id,
|
||||||
'工具' AS type,
|
'工具' AS type,
|
||||||
|
'2' as devType,
|
||||||
|
tl.type_id as typeId,
|
||||||
CONCAT(tt2.type_name, '/', tt3.type_name, '/', tt4.type_name) AS groupName,
|
CONCAT(tt2.type_name, '/', tt3.type_name, '/', tt4.type_name) AS groupName,
|
||||||
tt4.type_name as typeName,
|
tt4.type_name as typeName,
|
||||||
tt5.type_name as typeModelName,
|
tt5.type_name as typeModelName,
|
||||||
|
|
@ -46,9 +92,11 @@
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
CONCAT(mdi.ma_id,'-','设备') as keyId,
|
CONCAT(mdi.ma_id,'-','装备') as keyId,
|
||||||
mdi.ma_id as id,
|
mdi.ma_id as id,
|
||||||
'设备' as type,
|
'装备' as type,
|
||||||
|
'1' as devType,
|
||||||
|
mdi.type_id as typeId,
|
||||||
CONCAT(mt2.type_name, '/', mt3.type_name, '/', mt4.type_name) AS groupName,
|
CONCAT(mt2.type_name, '/', mt3.type_name, '/', mt4.type_name) AS groupName,
|
||||||
mdi.device_name as typeName,
|
mdi.device_name as typeName,
|
||||||
mdi.item_type_model as typeModelName,
|
mdi.item_type_model as typeModelName,
|
||||||
|
|
@ -71,4 +119,111 @@
|
||||||
AND mdi.`code` like concat('%',#{code},'%')
|
AND mdi.`code` like concat('%',#{code},'%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getMonthMaxOrderByDate" resultType="java.lang.Integer">
|
||||||
|
select COUNT(*)
|
||||||
|
from cs_device_change
|
||||||
|
where
|
||||||
|
month (create_time) = #{month}
|
||||||
|
and year (create_time) = #{year}
|
||||||
|
and `type` = #{type}
|
||||||
|
</select>
|
||||||
|
<select id="getRepairList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
||||||
|
SELECT cdc.id,
|
||||||
|
cdc.`code`,
|
||||||
|
SUM(CASE cdcd.dev_type
|
||||||
|
WHEN 1 THEN cdcd.num
|
||||||
|
ELSE 0
|
||||||
|
END) as equipmentNum,
|
||||||
|
SUM(CASE cdcd.dev_type
|
||||||
|
WHEN 2 THEN cdcd.num
|
||||||
|
ELSE 0
|
||||||
|
END) as toolNum,
|
||||||
|
CASE review_status
|
||||||
|
WHEN 0 THEN '审核中'
|
||||||
|
WHEN 1 THEN '已通过'
|
||||||
|
WHEN 2 THEN '已驳回'
|
||||||
|
END as `status`,
|
||||||
|
cdc.create_user as createUser,
|
||||||
|
cdc.create_time as createTime
|
||||||
|
FROM cs_device_change cdc
|
||||||
|
LEFT JOIN cs_device_change_details cdcd ON cdcd.change_id = cdc.id
|
||||||
|
WHERE cdc.type = '4'
|
||||||
|
and cdc.del_flag='0'
|
||||||
|
<if test="status != null and status!=''">
|
||||||
|
AND cdc.review_status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
||||||
|
AND cdc.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
|
</if>
|
||||||
|
GROUP BY cdc.id
|
||||||
|
ORDER BY cdc.create_time DESC
|
||||||
|
</select>
|
||||||
|
<select id="getRepairDetailsList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
||||||
|
SELECT '工具' as type,
|
||||||
|
CONCAT(tt2.type_name, '/', tt3.type_name, '/', tt4.type_name) AS groupName,
|
||||||
|
tt4.type_name as typeName,
|
||||||
|
tt5.type_name as typeModelName,
|
||||||
|
CASE
|
||||||
|
WHEN cdcd.dev_code is null THEN
|
||||||
|
'数量管理'
|
||||||
|
ELSE
|
||||||
|
'编码管理'
|
||||||
|
END manageMode,
|
||||||
|
cdcd.dev_code as `code`,
|
||||||
|
cdcd.num as repairNum,
|
||||||
|
cdcd.is_scrap as isScrap,
|
||||||
|
cdcd.repair_time as repairTime,
|
||||||
|
cdcd.reason_val as reasonVal,
|
||||||
|
CASE is_scrap
|
||||||
|
WHEN 0 THEN
|
||||||
|
repair_url
|
||||||
|
ELSE
|
||||||
|
reason_url
|
||||||
|
END url
|
||||||
|
FROM cs_device_change_details cdcd
|
||||||
|
LEFT JOIN tool_type tt5 on tt5.type_id = cdcd.dev_type_id
|
||||||
|
LEFT JOIN tool_type tt4 on tt4.type_id = tt5.parent_id
|
||||||
|
LEFT JOIN tool_type tt3 on tt3.type_id = tt4.parent_id
|
||||||
|
LEFT JOIN tool_type tt2 on tt2.type_id = tt3.parent_id
|
||||||
|
WHERE cdcd.change_id = #{id}
|
||||||
|
and cdcd.dev_type = '2'
|
||||||
|
and cdcd.del_flag='0'
|
||||||
|
GROUP BY cdcd.id
|
||||||
|
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
|
||||||
|
SELECT DISTINCT '装备' as type,
|
||||||
|
CONCAT(mt2.type_name, '/', mt3.type_name, '/', mt4.type_name) AS groupName,
|
||||||
|
mdi.device_name as typeName,
|
||||||
|
mdi.item_type_model as typeModelName,
|
||||||
|
CASE
|
||||||
|
WHEN cdcd.dev_code is null THEN
|
||||||
|
'数量管理'
|
||||||
|
ELSE
|
||||||
|
'编码管理'
|
||||||
|
END manageMode,
|
||||||
|
cdcd.dev_code as `code`,
|
||||||
|
cdcd.num as repairNum,
|
||||||
|
cdcd.is_scrap as isScrap,
|
||||||
|
cdcd.repair_time as repairTime,
|
||||||
|
cdcd.reason_val as reasonVal,
|
||||||
|
CASE is_scrap
|
||||||
|
WHEN 0 THEN
|
||||||
|
repair_url
|
||||||
|
ELSE
|
||||||
|
reason_url
|
||||||
|
END url
|
||||||
|
FROM cs_device_change_details cdcd
|
||||||
|
LEFT JOIN ma_dev_info mdi on mdi.type_id = cdcd.dev_type_id
|
||||||
|
LEFT JOIN ma_type mt5 on mt5.type_id = mdi.type_id
|
||||||
|
LEFT JOIN ma_type mt4 on mt4.type_id = mt5.parent_id
|
||||||
|
LEFT JOIN ma_type mt3 on mt3.type_id = mt4.parent_id
|
||||||
|
LEFT JOIN ma_type mt2 on mt2.type_id = mt3.parent_id
|
||||||
|
WHERE cdcd.change_id = #{id}
|
||||||
|
and cdcd.dev_type = '1'
|
||||||
|
and cdcd.del_flag='0'
|
||||||
|
GROUP BY cdcd.id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue