Browse Source

2025-10-21

固定载具的维护
master
fengyuan_yang 11 months ago
parent
commit
a2abd706bd
  1. 201
      src/main/java/com/gaotao/modules/fixedCarrier/controller/FixedCarrierController.java
  2. 71
      src/main/java/com/gaotao/modules/fixedCarrier/dao/FixedCarrierMapper.java
  3. 267
      src/main/java/com/gaotao/modules/fixedCarrier/entity/FixedCarrier.java
  4. 64
      src/main/java/com/gaotao/modules/fixedCarrier/service/FixedCarrierService.java
  5. 136
      src/main/java/com/gaotao/modules/fixedCarrier/service/impl/FixedCarrierServiceImpl.java
  6. 3
      src/main/java/com/gaotao/modules/pms/controller/QcController.java
  7. 2
      src/main/java/com/gaotao/modules/pms/mapper/QcMapper.java
  8. 4
      src/main/java/com/gaotao/modules/pms/service/Impl/QcServiceImpl.java
  9. 2
      src/main/java/com/gaotao/modules/pms/service/QcService.java
  10. 192
      src/main/resources/mapper/fixedCarrier/FixedCarrierMapper.xml
  11. 1
      src/main/resources/mapper/pms/QcMapper.xml

201
src/main/java/com/gaotao/modules/fixedCarrier/controller/FixedCarrierController.java

@ -0,0 +1,201 @@
package com.gaotao.modules.fixedCarrier.controller;
import com.gaotao.common.constant.SysMsgConstant;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.common.utils.R;
import com.gaotao.modules.fixedCarrier.entity.FixedCarrier;
import com.gaotao.modules.fixedCarrier.service.FixedCarrierService;
import com.gaotao.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 固定载具管理控制器
*/
@RestController
@RequestMapping("fixedCarrier")
public class FixedCarrierController extends AbstractController {
@Autowired
private FixedCarrierService fixedCarrierService;
/**
* 查询固定载具列表(带分页)
*/
@PostMapping("list")
public R list(@RequestBody Map<String, Object> params) {
try {
// 获取分页参数
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 20;
// 查询列表
List<Map<String, Object>> list = fixedCarrierService.queryList(params);
// 查询总数
int total = fixedCarrierService.queryTotal(params);
// 计算分页
int start = (page - 1) * limit;
int end = Math.min(start + limit, list.size());
List<Map<String, Object>> pageList = list.subList(start, end);
// 封装分页数据
PageUtils pageUtils = new PageUtils(pageList, total, limit, page);
return R.ok()
.put("code", 0)
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
.put("page", pageUtils);
} catch (Exception e) {
logger.error("查询固定载具列表失败", e);
return R.error("查询固定载具列表失败: " + e.getMessage());
}
}
/**
* 根据主键查询固定载具
*/
@PostMapping("info")
public R info(@RequestBody Map<String, Object> params) {
try {
String site = (String) params.get("site");
String buNo = (String) params.get("buNo");
String carrierNo = (String) params.get("carrierNo");
if (site == null || site.isEmpty()) {
return R.error("站点不能为空");
}
if (buNo == null || buNo.isEmpty()) {
return R.error("BU不能为空");
}
if (carrierNo == null || carrierNo.isEmpty()) {
return R.error("载具编码不能为空");
}
FixedCarrier fixedCarrier = fixedCarrierService.queryByPrimaryKey(site, buNo, carrierNo);
return R.ok()
.put("code", 0)
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
.put("data", fixedCarrier);
} catch (Exception e) {
logger.error("查询固定载具详情失败", e);
return R.error("查询固定载具详情失败: " + e.getMessage());
}
}
/**
* 新增固定载具
*/
@PostMapping("save")
public R save(@RequestBody FixedCarrier fixedCarrier) {
try {
// 参数校验
if (fixedCarrier.getSite() == null || fixedCarrier.getSite().isEmpty()) {
return R.error("站点不能为空");
}
if (fixedCarrier.getBuNo() == null || fixedCarrier.getBuNo().isEmpty()) {
return R.error("BU不能为空");
}
if (fixedCarrier.getCarrierNo() == null || fixedCarrier.getCarrierNo().isEmpty()) {
return R.error("载具编码不能为空");
}
if (fixedCarrier.getCarrierTypeCode() == null || fixedCarrier.getCarrierTypeCode().isEmpty()) {
return R.error("载具类型编码不能为空");
}
if (fixedCarrier.getCarrierTypeName() == null || fixedCarrier.getCarrierTypeName().isEmpty()) {
return R.error("载具类型名称不能为空");
}
if (fixedCarrier.getStatus() == null) {
return R.error("状态不能为空");
}
// 设置默认值
if (fixedCarrier.getTotalUsageCount() == null) {
fixedCarrier.setTotalUsageCount(0);
}
fixedCarrierService.save(fixedCarrier);
return R.ok()
.put("code", 0)
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200001));
} catch (Exception e) {
logger.error("新增固定载具失败", e);
return R.error("新增固定载具失败: " + e.getMessage());
}
}
/**
* 修改固定载具
*/
@PostMapping("update")
public R update(@RequestBody FixedCarrier fixedCarrier) {
try {
// 参数校验
if (fixedCarrier.getSite() == null || fixedCarrier.getSite().isEmpty()) {
return R.error("站点不能为空");
}
if (fixedCarrier.getBuNo() == null || fixedCarrier.getBuNo().isEmpty()) {
return R.error("BU不能为空");
}
if (fixedCarrier.getCarrierNo() == null || fixedCarrier.getCarrierNo().isEmpty()) {
return R.error("载具编码不能为空");
}
if (fixedCarrier.getCarrierTypeCode() == null || fixedCarrier.getCarrierTypeCode().isEmpty()) {
return R.error("载具类型编码不能为空");
}
if (fixedCarrier.getCarrierTypeName() == null || fixedCarrier.getCarrierTypeName().isEmpty()) {
return R.error("载具类型名称不能为空");
}
if (fixedCarrier.getStatus() == null) {
return R.error("状态不能为空");
}
fixedCarrierService.update(fixedCarrier);
return R.ok()
.put("code", 0)
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200002));
} catch (Exception e) {
logger.error("修改固定载具失败", e);
return R.error("修改固定载具失败: " + e.getMessage());
}
}
/**
* 删除固定载具
*/
@PostMapping("delete")
public R delete(@RequestBody Map<String, Object> params) {
try {
String site = (String) params.get("site");
String buNo = (String) params.get("buNo");
String carrierNo = (String) params.get("carrierNo");
if (site == null || site.isEmpty()) {
return R.error("站点不能为空");
}
if (buNo == null || buNo.isEmpty()) {
return R.error("BU不能为空");
}
if (carrierNo == null || carrierNo.isEmpty()) {
return R.error("载具编码不能为空");
}
fixedCarrierService.delete(site, buNo, carrierNo);
return R.ok()
.put("code", 0)
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200003));
} catch (Exception e) {
logger.error("删除固定载具失败", e);
return R.error("删除固定载具失败: " + e.getMessage());
}
}
}

71
src/main/java/com/gaotao/modules/fixedCarrier/dao/FixedCarrierMapper.java

@ -0,0 +1,71 @@
package com.gaotao.modules.fixedCarrier.dao;
import com.gaotao.modules.fixedCarrier.entity.FixedCarrier;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 固定载具Mapper接口
*/
@Mapper
public interface FixedCarrierMapper {
/**
* 查询固定载具列表
*
* @param params 查询参数
* @return 固定载具列表
*/
List<Map<String, Object>> queryList(Map<String, Object> params);
/**
* 根据主键查询固定载具
*
* @param site 站点
* @param buNo BU
* @param carrierNo 载具编码
* @return 固定载具信息
*/
FixedCarrier queryByPrimaryKey(@Param("site") String site,
@Param("buNo") String buNo,
@Param("carrierNo") String carrierNo);
/**
* 新增固定载具
*
* @param fixedCarrier 固定载具信息
* @return 影响行数
*/
int save(FixedCarrier fixedCarrier);
/**
* 修改固定载具
*
* @param fixedCarrier 固定载具信息
* @return 影响行数
*/
int update(FixedCarrier fixedCarrier);
/**
* 删除固定载具
*
* @param site 站点
* @param buNo BU
* @param carrierNo 载具编码
* @return 影响行数
*/
int delete(@Param("site") String site,
@Param("buNo") String buNo,
@Param("carrierNo") String carrierNo);
/**
* 查询总记录数
*
* @param params 查询参数
* @return 总记录数
*/
int queryTotal(Map<String, Object> params);
}

267
src/main/java/com/gaotao/modules/fixedCarrier/entity/FixedCarrier.java

@ -0,0 +1,267 @@
package com.gaotao.modules.fixedCarrier.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 固定载具实体类
* 对应数据库表:fixed_carrier
*/
public class FixedCarrier {
/**
* 站点
*/
private String site;
/**
* BU
*/
private String buNo;
/**
* 载具唯一编码(如 PAL-20250001)
*/
private String carrierNo;
/**
* 载具类型编码(如 Pallet, Bin, Rack)
*/
private String carrierTypeCode;
/**
* 载具类型名称(如 金属托盘、塑料周转箱)
*/
private String carrierTypeName;
/**
* 固定资产编号(用于财务对接)
*/
private String assetNo;
/**
* 规格描述(如 1200x800x150mm)
*/
private String specification;
/**
* 尺寸(长×宽×高,单位mm)
*/
private String dimensions;
/**
* 最大承重(kg)
*/
private BigDecimal maxWeight;
/**
* 预期使用次数(如500次)
*/
private Integer expectedLifeCycles;
/**
* 预期使用寿命(天)
*/
private Integer expectedLifeDays;
/**
* 状态:1=空闲 2=占用 3=维修 4=报废 5=外借
*/
private Integer status;
/**
* 当前所在位置(库位/区域/车间)
*/
private String currentLocation;
/**
* 最后使用时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date lastUsedTime;
/**
* 累计使用次数
*/
private Integer totalUsageCount;
/**
* 采购日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date purchaseDate;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createDate;
/**
* 备注
*/
private String remark;
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getBuNo() {
return buNo;
}
public void setBuNo(String buNo) {
this.buNo = buNo;
}
public String getCarrierNo() {
return carrierNo;
}
public void setCarrierNo(String carrierNo) {
this.carrierNo = carrierNo;
}
public String getCarrierTypeCode() {
return carrierTypeCode;
}
public void setCarrierTypeCode(String carrierTypeCode) {
this.carrierTypeCode = carrierTypeCode;
}
public String getCarrierTypeName() {
return carrierTypeName;
}
public void setCarrierTypeName(String carrierTypeName) {
this.carrierTypeName = carrierTypeName;
}
public String getAssetNo() {
return assetNo;
}
public void setAssetNo(String assetNo) {
this.assetNo = assetNo;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
public String getDimensions() {
return dimensions;
}
public void setDimensions(String dimensions) {
this.dimensions = dimensions;
}
public BigDecimal getMaxWeight() {
return maxWeight;
}
public void setMaxWeight(BigDecimal maxWeight) {
this.maxWeight = maxWeight;
}
public Integer getExpectedLifeCycles() {
return expectedLifeCycles;
}
public void setExpectedLifeCycles(Integer expectedLifeCycles) {
this.expectedLifeCycles = expectedLifeCycles;
}
public Integer getExpectedLifeDays() {
return expectedLifeDays;
}
public void setExpectedLifeDays(Integer expectedLifeDays) {
this.expectedLifeDays = expectedLifeDays;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getCurrentLocation() {
return currentLocation;
}
public void setCurrentLocation(String currentLocation) {
this.currentLocation = currentLocation;
}
public Date getLastUsedTime() {
return lastUsedTime;
}
public void setLastUsedTime(Date lastUsedTime) {
this.lastUsedTime = lastUsedTime;
}
public Integer getTotalUsageCount() {
return totalUsageCount;
}
public void setTotalUsageCount(Integer totalUsageCount) {
this.totalUsageCount = totalUsageCount;
}
public Date getPurchaseDate() {
return purchaseDate;
}
public void setPurchaseDate(Date purchaseDate) {
this.purchaseDate = purchaseDate;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

64
src/main/java/com/gaotao/modules/fixedCarrier/service/FixedCarrierService.java

@ -0,0 +1,64 @@
package com.gaotao.modules.fixedCarrier.service;
import com.gaotao.modules.fixedCarrier.entity.FixedCarrier;
import java.util.List;
import java.util.Map;
/**
* 固定载具Service接口
*/
public interface FixedCarrierService {
/**
* 查询固定载具列表
*
* @param params 查询参数
* @return 固定载具列表
*/
List<Map<String, Object>> queryList(Map<String, Object> params);
/**
* 根据主键查询固定载具
*
* @param site 站点
* @param buNo BU
* @param carrierNo 载具编码
* @return 固定载具信息
*/
FixedCarrier queryByPrimaryKey(String site, String buNo, String carrierNo);
/**
* 新增固定载具
*
* @param fixedCarrier 固定载具信息
* @return 影响行数
*/
int save(FixedCarrier fixedCarrier);
/**
* 修改固定载具
*
* @param fixedCarrier 固定载具信息
* @return 影响行数
*/
int update(FixedCarrier fixedCarrier);
/**
* 删除固定载具
*
* @param site 站点
* @param buNo BU
* @param carrierNo 载具编码
* @return 影响行数
*/
int delete(String site, String buNo, String carrierNo);
/**
* 查询总记录数
*
* @param params 查询参数
* @return 总记录数
*/
int queryTotal(Map<String, Object> params);
}

136
src/main/java/com/gaotao/modules/fixedCarrier/service/impl/FixedCarrierServiceImpl.java

@ -0,0 +1,136 @@
package com.gaotao.modules.fixedCarrier.service.impl;
import com.gaotao.modules.fixedCarrier.dao.FixedCarrierMapper;
import com.gaotao.modules.fixedCarrier.entity.FixedCarrier;
import com.gaotao.modules.fixedCarrier.service.FixedCarrierService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* 固定载具Service实现类
*/
@Service("fixedCarrierService")
public class FixedCarrierServiceImpl implements FixedCarrierService {
private static final Logger logger = LoggerFactory.getLogger(FixedCarrierServiceImpl.class);
@Autowired
private FixedCarrierMapper fixedCarrierMapper;
@Override
public List<Map<String, Object>> queryList(Map<String, Object> params) {
logger.info("查询固定载具列表,参数: {}", params);
try {
List<Map<String, Object>> list = fixedCarrierMapper.queryList(params);
logger.info("查询固定载具列表成功,记录数: {}", list != null ? list.size() : 0);
return list;
} catch (Exception e) {
logger.error("查询固定载具列表失败,错误信息: {}", e.getMessage(), e);
throw new RuntimeException("查询固定载具列表失败: " + e.getMessage(), e);
}
}
@Override
public FixedCarrier queryByPrimaryKey(String site, String buNo, String carrierNo) {
logger.info("根据主键查询固定载具,站点: {}, BU: {}, 载具编码: {}", site, buNo, carrierNo);
try {
FixedCarrier fixedCarrier = fixedCarrierMapper.queryByPrimaryKey(site, buNo, carrierNo);
logger.info("根据主键查询固定载具成功");
return fixedCarrier;
} catch (Exception e) {
logger.error("根据主键查询固定载具失败,错误信息: {}", e.getMessage(), e);
throw new RuntimeException("根据主键查询固定载具失败: " + e.getMessage(), e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public int save(FixedCarrier fixedCarrier) {
logger.info("新增固定载具,载具编码: {}", fixedCarrier.getCarrierNo());
try {
// 检查是否已存在
FixedCarrier existCarrier = fixedCarrierMapper.queryByPrimaryKey(
fixedCarrier.getSite(),
fixedCarrier.getBuNo(),
fixedCarrier.getCarrierNo()
);
if (existCarrier != null) {
logger.error("固定载具已存在,载具编码: {}", fixedCarrier.getCarrierNo());
throw new RuntimeException("固定载具已存在");
}
int result = fixedCarrierMapper.save(fixedCarrier);
logger.info("新增固定载具成功,载具编码: {}", fixedCarrier.getCarrierNo());
return result;
} catch (Exception e) {
logger.error("新增固定载具失败,错误信息: {}", e.getMessage(), e);
throw new RuntimeException("新增固定载具失败: " + e.getMessage(), e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public int update(FixedCarrier fixedCarrier) {
logger.info("修改固定载具,载具编码: {}", fixedCarrier.getCarrierNo());
try {
// 检查是否存在
FixedCarrier existCarrier = fixedCarrierMapper.queryByPrimaryKey(
fixedCarrier.getSite(),
fixedCarrier.getBuNo(),
fixedCarrier.getCarrierNo()
);
if (existCarrier == null) {
logger.error("固定载具不存在,载具编码: {}", fixedCarrier.getCarrierNo());
throw new RuntimeException("固定载具不存在");
}
int result = fixedCarrierMapper.update(fixedCarrier);
logger.info("修改固定载具成功,载具编码: {}", fixedCarrier.getCarrierNo());
return result;
} catch (Exception e) {
logger.error("修改固定载具失败,错误信息: {}", e.getMessage(), e);
throw new RuntimeException("修改固定载具失败: " + e.getMessage(), e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public int delete(String site, String buNo, String carrierNo) {
logger.info("删除固定载具,站点: {}, BU: {}, 载具编码: {}", site, buNo, carrierNo);
try {
// 检查是否存在
FixedCarrier existCarrier = fixedCarrierMapper.queryByPrimaryKey(site, buNo, carrierNo);
if (existCarrier == null) {
logger.error("固定载具不存在,载具编码: {}", carrierNo);
throw new RuntimeException("固定载具不存在");
}
int result = fixedCarrierMapper.delete(site, buNo, carrierNo);
logger.info("删除固定载具成功,载具编码: {}", carrierNo);
return result;
} catch (Exception e) {
logger.error("删除固定载具失败,错误信息: {}", e.getMessage(), e);
throw new RuntimeException("删除固定载具失败: " + e.getMessage(), e);
}
}
@Override
public int queryTotal(Map<String, Object> params) {
logger.info("查询固定载具总记录数,参数: {}", params);
try {
int total = fixedCarrierMapper.queryTotal(params);
logger.info("查询固定载具总记录数成功,总数: {}", total);
return total;
} catch (Exception e) {
logger.error("查询固定载具总记录数失败,错误信息: {}", e.getMessage(), e);
throw new RuntimeException("查询固定载具总记录数失败: " + e.getMessage(), e);
}
}
}

3
src/main/java/com/gaotao/modules/pms/controller/QcController.java

@ -1674,7 +1674,8 @@ public class QcController {
//String buNo = params.get("buNo");
String orderNo = params.get("orderNo");
String resourceId = params.get("resourceId");
int count = qcService.checkProcessInspectionPendingCount(site, orderNo, resourceId);
String seqNo = params.get("seqNo");
int count = qcService.checkProcessInspectionPendingCount(site, orderNo, resourceId, seqNo);
return R.ok().put("count", count);
}

2
src/main/java/com/gaotao/modules/pms/mapper/QcMapper.java

@ -466,5 +466,5 @@ public interface QcMapper {
/**
* 查询过程检验待检验记录数量
*/
int checkProcessInspectionPendingCount(@Param("site") String site, @Param("orderNo") String orderNo, @Param("resourceId") String resourceId);
int checkProcessInspectionPendingCount(@Param("site") String site, @Param("orderNo") String orderNo, @Param("resourceId") String resourceId, @Param("seqNo") String seqNo);
}

4
src/main/java/com/gaotao/modules/pms/service/Impl/QcServiceImpl.java

@ -3519,8 +3519,8 @@ public class QcServiceImpl implements QcService {
* 查询过程检验待检验记录数量
*/
@Override
public int checkProcessInspectionPendingCount(String site, String orderNo, String resourceId) {
return qcMapper.checkProcessInspectionPendingCount(site, orderNo, resourceId);
public int checkProcessInspectionPendingCount(String site, String orderNo, String resourceId, String seqNo) {
return qcMapper.checkProcessInspectionPendingCount(site, orderNo, resourceId, seqNo);
}
}

2
src/main/java/com/gaotao/modules/pms/service/QcService.java

@ -264,5 +264,5 @@ public interface QcService {
/**
* 查询过程检验待检验记录数量
*/
int checkProcessInspectionPendingCount(String site, String orderNo, String resourceId);
int checkProcessInspectionPendingCount(String site, String orderNo, String resourceId, String seqNo);
}

192
src/main/resources/mapper/fixedCarrier/FixedCarrierMapper.xml

@ -0,0 +1,192 @@
<?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">
<mapper namespace="com.gaotao.modules.fixedCarrier.dao.FixedCarrierMapper">
<!-- 结果映射 -->
<resultMap id="fixedCarrierMap" type="com.gaotao.modules.fixedCarrier.entity.FixedCarrier">
<result property="site" column="site"/>
<result property="buNo" column="bu_no"/>
<result property="carrierNo" column="carrier_no"/>
<result property="carrierTypeCode" column="carrier_type_code"/>
<result property="carrierTypeName" column="carrier_type_name"/>
<result property="assetNo" column="asset_no"/>
<result property="specification" column="specification"/>
<result property="dimensions" column="dimensions"/>
<result property="maxWeight" column="max_weight"/>
<result property="expectedLifeCycles" column="expected_life_cycles"/>
<result property="expectedLifeDays" column="expected_life_days"/>
<result property="status" column="status"/>
<result property="currentLocation" column="current_location"/>
<result property="lastUsedTime" column="last_used_time"/>
<result property="totalUsageCount" column="total_usage_count"/>
<result property="purchaseDate" column="purchase_date"/>
<result property="createBy" column="create_by"/>
<result property="createDate" column="create_date"/>
<result property="remark" column="remark"/>
</resultMap>
<!-- 查询固定载具列表 -->
<select id="queryList" resultType="map">
SELECT
site,
bu_no AS buNo,
carrier_no AS carrierNo,
carrier_type_code AS carrierTypeCode,
carrier_type_name AS carrierTypeName,
asset_no AS assetNo,
specification,
dimensions,
max_weight AS maxWeight,
expected_life_cycles AS expectedLifeCycles,
expected_life_days AS expectedLifeDays,
status,
current_location AS currentLocation,
last_used_time AS lastUsedTime,
total_usage_count AS totalUsageCount,
purchase_date AS purchaseDate,
create_by AS createBy,
create_date AS createDate,
remark
FROM fixed_carrier
WHERE 1=1
<if test="site != null and site != ''">
AND site = #{site}
</if>
<if test="buNo != null and buNo != ''">
AND bu_no = #{buNo}
</if>
<if test="carrierNo != null and carrierNo != ''">
AND carrier_no LIKE '%' + #{carrierNo} + '%'
</if>
<if test="carrierTypeName != null and carrierTypeName != ''">
AND carrier_type_name LIKE '%' + #{carrierTypeName} + '%'
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
ORDER BY create_date DESC
</select>
<!-- 根据主键查询固定载具 -->
<select id="queryByPrimaryKey" resultMap="fixedCarrierMap">
SELECT
site,
bu_no,
carrier_no,
carrier_type_code,
carrier_type_name,
asset_no,
specification,
dimensions,
max_weight,
expected_life_cycles,
expected_life_days,
status,
current_location,
last_used_time,
total_usage_count,
purchase_date,
create_by,
create_date,
remark
FROM fixed_carrier
WHERE site = #{site}
AND bu_no = #{buNo}
AND carrier_no = #{carrierNo}
</select>
<!-- 新增固定载具 -->
<insert id="save">
INSERT INTO fixed_carrier (
site,
bu_no,
carrier_no,
carrier_type_code,
carrier_type_name,
asset_no,
specification,
dimensions,
max_weight,
expected_life_cycles,
expected_life_days,
status,
current_location,
purchase_date,
create_by,
create_date,
remark
) VALUES (
#{site},
#{buNo},
#{carrierNo},
#{carrierTypeCode},
#{carrierTypeName},
#{assetNo},
#{specification},
#{dimensions},
#{maxWeight},
#{expectedLifeCycles},
#{expectedLifeDays},
#{status},
#{currentLocation},
#{purchaseDate},
#{createBy},
GETDATE(),
#{remark}
)
</insert>
<!-- 修改固定载具 -->
<update id="update">
UPDATE fixed_carrier
SET
carrier_type_code = #{carrierTypeCode},
carrier_type_name = #{carrierTypeName},
asset_no = #{assetNo},
specification = #{specification},
dimensions = #{dimensions},
max_weight = #{maxWeight},
expected_life_cycles = #{expectedLifeCycles},
expected_life_days = #{expectedLifeDays},
status = #{status},
current_location = #{currentLocation},
purchase_date = #{purchaseDate},
remark = #{remark}
WHERE site = #{site}
AND bu_no = #{buNo}
AND carrier_no = #{carrierNo}
</update>
<!-- 删除固定载具 -->
<delete id="delete">
DELETE FROM fixed_carrier
WHERE site = #{site}
AND bu_no = #{buNo}
AND carrier_no = #{carrierNo}
</delete>
<!-- 查询总记录数 -->
<select id="queryTotal" resultType="int">
SELECT COUNT(*)
FROM fixed_carrier
WHERE 1=1
<if test="site != null and site != ''">
AND site = #{site}
</if>
<if test="buNo != null and buNo != ''">
AND bu_no = #{buNo}
</if>
<if test="carrierNo != null and carrierNo != ''">
AND carrier_no LIKE '%' + #{carrierNo} + '%'
</if>
<if test="carrierTypeName != null and carrierTypeName != ''">
AND carrier_type_name LIKE '%' + #{carrierTypeName} + '%'
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</select>
</mapper>

1
src/main/resources/mapper/pms/QcMapper.xml

@ -3326,6 +3326,7 @@
AND order_no = #{orderNo}
AND resource_id = #{resourceId}
AND state IN ('未开始', '待检验')
and seq_no = #{seqNo}
</select>
</mapper>

Loading…
Cancel
Save