This commit is contained in:
		
							parent
							
								
									a765c3fb65
								
							
						
					
					
						commit
						89c6bc6d6a
					
				| 
						 | 
				
			
			@ -113,9 +113,10 @@ public class MaterialLeaseInfoController extends BaseController {
 | 
			
		|||
    @ApiOperation(value = "查询总站点领料详情数据")
 | 
			
		||||
    @GetMapping("/getDetailsList")
 | 
			
		||||
    public AjaxResult getDetailsList(MaterialLeaseApplyInfo leaseApplyInfo) {
 | 
			
		||||
        startPage();
 | 
			
		||||
        Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
 | 
			
		||||
        Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
 | 
			
		||||
        List<MaterialLeaseApplyInfo> list = materialLeaseInfoService.getDetailsList(leaseApplyInfo);
 | 
			
		||||
        return AjaxResult.success(getDataTable(list));
 | 
			
		||||
        return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ public class MaterialRetainedEquipmentInfo {
 | 
			
		|||
    private BigDecimal buyPrice;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "原值")
 | 
			
		||||
    //@Excel(name = "原值(万元)", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
 | 
			
		||||
    @Excel(name = "原值(万元)", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
 | 
			
		||||
    private BigDecimal totalPrice;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "五年以内成新率")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -491,4 +491,11 @@ public interface MaterialLeaseInfoMapper {
 | 
			
		|||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    LeaseApplyInfo selectPublishInfo(Long parentId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取领用数据
 | 
			
		||||
     * @param leaseApplyInfo
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    List<MaterialLeaseApplyInfo> getPublishList(MaterialLeaseApplyInfo leaseApplyInfo);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -326,7 +326,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
 | 
			
		|||
                        .collect(Collectors.toList());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 查询所有未结算的工程
 | 
			
		||||
           /* // 查询所有未结算的工程
 | 
			
		||||
            List<String> projectIdList = mapper.getUnsettledProId();
 | 
			
		||||
            // 使用 HashSet 来加速查找过程
 | 
			
		||||
            Set<String> unsettledProjectIds = new HashSet<>(projectIdList);
 | 
			
		||||
| 
						 | 
				
			
			@ -340,7 +340,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
 | 
			
		|||
                if (proId == null || !unsettledProjectIds.contains(proId)) {
 | 
			
		||||
                    iterator.remove();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            }*/
 | 
			
		||||
        }
 | 
			
		||||
        return sortedList;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -548,7 +548,11 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
 | 
			
		|||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<MaterialLeaseApplyInfo> getDetailsList(MaterialLeaseApplyInfo leaseApplyInfo) {
 | 
			
		||||
        return materialLeaseInfoMapper.getDetailsList(leaseApplyInfo);
 | 
			
		||||
        List<MaterialLeaseApplyInfo> list = materialLeaseInfoMapper.getDetailsList(leaseApplyInfo);
 | 
			
		||||
        if (CollectionUtils.isEmpty(list)) {
 | 
			
		||||
            list = materialLeaseInfoMapper.getPublishList(leaseApplyInfo);
 | 
			
		||||
        }
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1014,7 +1014,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
 | 
			
		|||
        info.setRopeNum(inRopeNum.add(useRopeNum).add(useRopeNumSub));
 | 
			
		||||
        // 投入费用(万元)
 | 
			
		||||
        info.setTotalPrice(totalPrice);
 | 
			
		||||
        /*// 租赁费用(万元)
 | 
			
		||||
        // 租赁费用(万元)
 | 
			
		||||
        List<MaterialRetainedEquipmentInfo> leaseInfoList = materialMachineMapper.getLeaseInfo(bean);
 | 
			
		||||
        if (CollectionUtils.isNotEmpty(leaseInfoList)) {
 | 
			
		||||
            rentPrice = leaseInfoList.stream()
 | 
			
		||||
| 
						 | 
				
			
			@ -1025,7 +1025,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
 | 
			
		|||
                    .setScale(3, RoundingMode.HALF_UP);
 | 
			
		||||
        } else {
 | 
			
		||||
            info.setRentPrice(BigDecimal.ZERO);
 | 
			
		||||
        }*/
 | 
			
		||||
        }
 | 
			
		||||
        info.setRentPrice(rentPrice);
 | 
			
		||||
        return info;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ public class ExpectationsEntity {
 | 
			
		|||
    private int aboutToExpireCount;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 超期类别
 | 
			
		||||
     * 超期类别(0 超期,1 临期)
 | 
			
		||||
     */
 | 
			
		||||
    private String status;
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,4 +27,19 @@ public interface ExpectationsMapper {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
    List<ExpectationsEntity> getListDetails(ExpectationsEntity entity);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 在用设备量
 | 
			
		||||
     * @param entity
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @MapKey("name")
 | 
			
		||||
    Map<String, Objects> getUseCountExpectations(ExpectationsEntity entity);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 在用设备列表
 | 
			
		||||
     * @param entity
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    List<ExpectationsEntity> getUserList(ExpectationsEntity entity);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,10 @@ public class ExpectationsServiceImpl implements ExpectationsService {
 | 
			
		|||
    public List<ExpectationsEntity> getExpectationsList(ExpectationsEntity entity) {
 | 
			
		||||
        try {
 | 
			
		||||
            List<ExpectationsEntity> expectationsList = mapper.getExpectationsList(entity);
 | 
			
		||||
            if (entity != null && "2".equals(entity.getUseStatus())) {
 | 
			
		||||
                //在用设备列表
 | 
			
		||||
                expectationsList = mapper.getUserList(entity);
 | 
			
		||||
            }
 | 
			
		||||
            return ObjectUtils.isNotEmpty(expectationsList) ? expectationsList : Collections.emptyList();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.error(e.getMessage());
 | 
			
		||||
| 
						 | 
				
			
			@ -48,6 +52,10 @@ public class ExpectationsServiceImpl implements ExpectationsService {
 | 
			
		|||
    public AjaxResult getCountExpectations(ExpectationsEntity entity) {
 | 
			
		||||
        try {
 | 
			
		||||
            Map<String, Objects> countExpectations = mapper.getCountExpectations(entity);
 | 
			
		||||
            if (entity != null && "2".equals(entity.getUseStatus())) {
 | 
			
		||||
                //在用设备量
 | 
			
		||||
                countExpectations = mapper.getUseCountExpectations(entity);
 | 
			
		||||
            }
 | 
			
		||||
            return ObjectUtils.isNotEmpty(countExpectations) ? AjaxResult.success(countExpectations) : AjaxResult.error();
 | 
			
		||||
        }catch (Exception e) {
 | 
			
		||||
            log.error(e.getMessage());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1758,4 +1758,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            parent_id = #{parentId}
 | 
			
		||||
            LIMIT 1
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getPublishList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
 | 
			
		||||
        SELECT
 | 
			
		||||
            mt.type_name as modelCode,
 | 
			
		||||
            mt2.type_name AS typeCode,
 | 
			
		||||
            mt.manage_type AS manageType,
 | 
			
		||||
            IFNULL( lod.out_num, 0 ) AS preCountNum,
 | 
			
		||||
            mt.unit_name as unitNames,
 | 
			
		||||
            mm.ma_code as maCode
 | 
			
		||||
        FROM
 | 
			
		||||
            lease_out_details lod
 | 
			
		||||
                LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
 | 
			
		||||
                LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
 | 
			
		||||
                AND mt.`level` = '4' AND mt.del_flag = '0'
 | 
			
		||||
                LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
 | 
			
		||||
                AND mt2.`level` = '3' AND mt2.del_flag = '0'
 | 
			
		||||
                LEFT JOIN (SELECT parent_id,code,publish_task from lease_publish_details
 | 
			
		||||
                GROUP BY publish_task) lpd
 | 
			
		||||
                ON lod.parent_id = lpd.parent_id
 | 
			
		||||
                AND lod.publish_task = lpd.publish_task
 | 
			
		||||
        WHERE
 | 
			
		||||
            lpd.`code` = #{code}
 | 
			
		||||
    </select>
 | 
			
		||||
</mapper>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2597,7 +2597,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        sai.type_id AS typeId,
 | 
			
		||||
        lai.code AS code,
 | 
			
		||||
        sai.ma_id AS maId,
 | 
			
		||||
        bp.pro_name AS proName
 | 
			
		||||
        bp.pro_name AS proName,
 | 
			
		||||
        CASE WHEN
 | 
			
		||||
        lai.direct_id IS NULL
 | 
			
		||||
        THEN '1' ELSE '0'
 | 
			
		||||
        END AS directFlag
 | 
			
		||||
        FROM
 | 
			
		||||
        slt_agreement_info sai
 | 
			
		||||
        LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,25 +6,136 @@
 | 
			
		|||
 | 
			
		||||
    <select id="getExpectationsList" resultType="com.bonus.material.expectations.domain.ExpectationsEntity">
 | 
			
		||||
        SELECT
 | 
			
		||||
        CASE
 | 
			
		||||
        WHEN mm.ma_status = '2' THEN bu.unit_name
 | 
			
		||||
        ELSE NULL
 | 
			
		||||
        END AS unit,
 | 
			
		||||
        CASE
 | 
			
		||||
        WHEN mm.ma_status = '2' THEN bp.pro_name
 | 
			
		||||
        ELSE NULL
 | 
			
		||||
        END AS project,
 | 
			
		||||
        mm.type_id AS typeId,
 | 
			
		||||
        sai.agreement_id AS agreementId,
 | 
			
		||||
        COUNT(*) AS count,
 | 
			
		||||
        mt2.type_name AS typeName,
 | 
			
		||||
        mt1.type_name AS specCode,
 | 
			
		||||
        COUNT(*) AS count,
 | 
			
		||||
        GROUP_CONCAT(mm.ma_id ORDER BY mm.ma_id SEPARATOR ',') AS maIds,
 | 
			
		||||
        CASE
 | 
			
		||||
        WHEN mm.next_check_time < CURDATE() THEN 'expired'
 | 
			
		||||
        ELSE 'about_to_expire'
 | 
			
		||||
        WHEN mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY) THEN 'about_to_expire'
 | 
			
		||||
        END AS status
 | 
			
		||||
        FROM
 | 
			
		||||
        ma_machine mm
 | 
			
		||||
        LEFT JOIN ma_type mt1 ON mm.type_id = mt1.type_id
 | 
			
		||||
        LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
 | 
			
		||||
        WHERE
 | 
			
		||||
        mm.ma_status = #{useStatus}
 | 
			
		||||
        AND mt2.type_id NOT IN (6032, 6008, 6270, 6012, 6761)
 | 
			
		||||
        AND mm.next_check_time is not NULL
 | 
			
		||||
        AND (
 | 
			
		||||
        mm.next_check_time < CURDATE()
 | 
			
		||||
        OR mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
 | 
			
		||||
        )
 | 
			
		||||
        <if test="keyWord != null and keyWord != ''">
 | 
			
		||||
            AND (
 | 
			
		||||
            mt2.type_name LIKE CONCAT('%', #{keyWord}, '%') OR
 | 
			
		||||
            mt1.type_name LIKE CONCAT('%', #{keyWord}, '%')
 | 
			
		||||
            )
 | 
			
		||||
        </if>
 | 
			
		||||
        GROUP BY
 | 
			
		||||
        mm.type_id,
 | 
			
		||||
        status
 | 
			
		||||
        ORDER BY
 | 
			
		||||
        status,
 | 
			
		||||
        SUBSTRING( mt2.type_name, 1, 1 ) ASC
 | 
			
		||||
    </select>
 | 
			
		||||
    <select id="getCountExpectations" resultType="java.util.Map">
 | 
			
		||||
        SELECT
 | 
			
		||||
        CASE
 | 
			
		||||
        WHEN mm.next_check_time < CURDATE() THEN 'expired'
 | 
			
		||||
        WHEN mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY) THEN 'aboutToExpire'
 | 
			
		||||
        END AS name,
 | 
			
		||||
        COUNT(*) AS count
 | 
			
		||||
        FROM ma_machine mm
 | 
			
		||||
        LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
 | 
			
		||||
        LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
 | 
			
		||||
        WHERE mm.ma_status = #{useStatus}
 | 
			
		||||
        AND mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
 | 
			
		||||
        AND mt2.type_id not in (6032,6008,6270,6012,6761)
 | 
			
		||||
        GROUP BY name;
 | 
			
		||||
    </select>
 | 
			
		||||
    <select id="getListDetails" resultType="com.bonus.material.expectations.domain.ExpectationsEntity">
 | 
			
		||||
        SELECT
 | 
			
		||||
        mt2.type_name      AS typeName,
 | 
			
		||||
        mt1.type_name      AS specCode,
 | 
			
		||||
        mm.ma_code         AS maCode,
 | 
			
		||||
        mm.next_check_time AS nextCheckTime
 | 
			
		||||
        FROM
 | 
			
		||||
        ma_machine mm
 | 
			
		||||
        LEFT JOIN ma_type mt1 ON mm.type_id = mt1.type_id
 | 
			
		||||
        LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
 | 
			
		||||
        LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
 | 
			
		||||
        <where>
 | 
			
		||||
            <if test="useStatus == 1">
 | 
			
		||||
                AND mm.ma_status = #{useStatus}
 | 
			
		||||
                AND mm.type_id = #{typeId}
 | 
			
		||||
                <!-- 提取status条件为公共片段,减少重复代码 -->
 | 
			
		||||
                <include refid="statusCondition"/>
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="useStatus == 2">
 | 
			
		||||
                AND mm.ma_status = #{useStatus}
 | 
			
		||||
                AND sai.agreement_id = #{agreementId}
 | 
			
		||||
                AND mm.type_id = #{typeId}
 | 
			
		||||
                <!-- 提取status条件为公共片段,减少重复代码 -->
 | 
			
		||||
                <include refid="statusCondition"/>
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="keyWord != null and keyWord != ''">
 | 
			
		||||
                AND mm.ma_code LIKE CONCAT('%', #{keyWord}, '%')
 | 
			
		||||
            </if>
 | 
			
		||||
        </where>
 | 
			
		||||
        GROUP BY
 | 
			
		||||
        mm.ma_id
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <!-- 定义status条件的公共片段 -->
 | 
			
		||||
    <sql id="statusCondition">
 | 
			
		||||
        <if test="status != null">
 | 
			
		||||
            <choose>
 | 
			
		||||
                <when test="status == 0">
 | 
			
		||||
                    AND mm.next_check_time < CURDATE()
 | 
			
		||||
                </when>
 | 
			
		||||
                <when test="status == 1">
 | 
			
		||||
                    AND mm.next_check_time >= CURDATE()
 | 
			
		||||
                    AND mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
 | 
			
		||||
                </when>
 | 
			
		||||
            </choose>
 | 
			
		||||
        </if>
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
    <select id="getUseCountExpectations" resultType="java.util.Map">
 | 
			
		||||
        SELECT
 | 
			
		||||
        CASE
 | 
			
		||||
        WHEN mm.next_check_time < CURDATE() THEN 'expired'
 | 
			
		||||
        WHEN mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY) THEN 'aboutToExpire'
 | 
			
		||||
        END AS name,
 | 
			
		||||
        COUNT(*) AS count
 | 
			
		||||
        FROM ma_machine mm
 | 
			
		||||
        LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
 | 
			
		||||
        LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
 | 
			
		||||
        LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
 | 
			
		||||
        WHERE mm.ma_status = #{useStatus}
 | 
			
		||||
        AND sai.is_slt = '0'
 | 
			
		||||
        AND sai.`status` = '0'
 | 
			
		||||
        AND mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
 | 
			
		||||
        AND mt2.type_id not in (6032,6008,6270,6012,6761)
 | 
			
		||||
        GROUP BY name;
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getUserList" resultType="com.bonus.material.expectations.domain.ExpectationsEntity">
 | 
			
		||||
        SELECT
 | 
			
		||||
        bu.unit_name AS unit,
 | 
			
		||||
        bp.pro_name AS project,
 | 
			
		||||
        mm.type_id AS typeId,
 | 
			
		||||
        COUNT(*) AS count,
 | 
			
		||||
        mt2.type_name AS typeName,
 | 
			
		||||
        mt1.type_name AS specCode,
 | 
			
		||||
        CASE
 | 
			
		||||
        WHEN mm.next_check_time < CURDATE() THEN 'expired'
 | 
			
		||||
        WHEN mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY) THEN 'about_to_expire'
 | 
			
		||||
        END AS status,
 | 
			
		||||
        sai.agreement_id AS agreementId
 | 
			
		||||
        FROM
 | 
			
		||||
        ma_machine mm
 | 
			
		||||
        LEFT JOIN ma_type mt1 ON mm.type_id = mt1.type_id
 | 
			
		||||
        LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
 | 
			
		||||
        LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
 | 
			
		||||
| 
						 | 
				
			
			@ -33,6 +144,10 @@
 | 
			
		|||
        LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
 | 
			
		||||
        WHERE
 | 
			
		||||
        mm.ma_status = #{useStatus}
 | 
			
		||||
        AND sai.is_slt = '0'
 | 
			
		||||
        AND sai.`status` = '0'
 | 
			
		||||
        AND mt2.type_id NOT IN (6032, 6008, 6270, 6012, 6761)
 | 
			
		||||
        AND mm.next_check_time is not NULL
 | 
			
		||||
        AND (
 | 
			
		||||
        mm.next_check_time < CURDATE()
 | 
			
		||||
        OR mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
 | 
			
		||||
| 
						 | 
				
			
			@ -48,46 +163,10 @@
 | 
			
		|||
        GROUP BY
 | 
			
		||||
        unit,
 | 
			
		||||
        project,
 | 
			
		||||
        mt2.type_name,
 | 
			
		||||
        mt1.type_name,
 | 
			
		||||
        mm.type_id,
 | 
			
		||||
        status
 | 
			
		||||
        ORDER BY
 | 
			
		||||
        status,
 | 
			
		||||
        unit,
 | 
			
		||||
        project
 | 
			
		||||
    </select>
 | 
			
		||||
    <select id="getCountExpectations" resultType="java.util.Map">
 | 
			
		||||
        SELECT
 | 
			
		||||
        CASE
 | 
			
		||||
        WHEN next_check_time < CURDATE() THEN 'expired'
 | 
			
		||||
        WHEN next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY) THEN 'aboutToExpire'
 | 
			
		||||
        END AS name,
 | 
			
		||||
        COUNT(*) AS count
 | 
			
		||||
        FROM ma_machine
 | 
			
		||||
        WHERE ma_status = #{useStatus}
 | 
			
		||||
        AND next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
 | 
			
		||||
        GROUP BY name;
 | 
			
		||||
    </select>
 | 
			
		||||
    <select id="getListDetails" resultType="com.bonus.material.expectations.domain.ExpectationsEntity">
 | 
			
		||||
        SELECT
 | 
			
		||||
        mt2.type_name      AS typeName,
 | 
			
		||||
        mt1.type_name      AS specCode,
 | 
			
		||||
        mm.ma_code         AS maCode,
 | 
			
		||||
        mm.next_check_time AS nextCheckTime
 | 
			
		||||
        FROM
 | 
			
		||||
        ma_machine mm
 | 
			
		||||
        LEFT JOIN ma_type mt1 ON mm.type_id = mt1.type_id
 | 
			
		||||
        LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
 | 
			
		||||
        LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
 | 
			
		||||
        WHERE
 | 
			
		||||
        <choose>
 | 
			
		||||
            <when test="useStatus == 2">
 | 
			
		||||
                sai.agreement_id = #{agreementId}
 | 
			
		||||
                AND sai.type_id = #{typeId}
 | 
			
		||||
            </when>
 | 
			
		||||
            <when test="useStatus == 1">
 | 
			
		||||
                mm.type_id = #{typeId}
 | 
			
		||||
            </when>
 | 
			
		||||
        </choose>
 | 
			
		||||
        SUBSTRING( mt2.type_name, 1, 1 ) ASC
 | 
			
		||||
    </select>
 | 
			
		||||
</mapper>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue