Files
agt-cloud/agt-module-license/agt-module-license-server/src/main/resources/mapper/project/ProjectMapper.xml
2025-08-15 15:58:58 +08:00

68 lines
2.8 KiB
XML

<?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="org.agt.module.license.dal.mysql.project.ProjectMapper">
<select id="selectMaxCode" resultType="Integer">
SELECT max(`code` + 0) from crm_project;
</select>
<select id="queryPage" resultType="org.agt.module.license.controller.admin.project.vo.ProjectRespVO">
SELECT
p.*,
CONCAT( c.`code`, p.`code` ) serial_no
FROM
crm_project p
LEFT JOIN crm_customer c ON p.customer_id = c.id
AND c.deleted = 0
WHERE
p.deleted = 0
<if test="query.customerId != null">
AND p.customer_id = #{query.customerId}
</if>
<if test="query.name != null and query.name != ''">
AND p.name LIKE CONCAT('%',#{query.name},'%')
</if>
<if test="query.code != null and query.code != ''">
AND p.code LIKE CONCAT('%',#{query.code },'%')
</if>
<if test="query.contractCode != null and query.contractCode != ''">
AND p.contract_code LIKE CONCAT('%',#{query.contractCode},'%')
</if>
<if test="query.businessStatus != null">
AND p.business_status = #{query.businessStatus}
</if>
<if test="query.businessOwner != null">
AND p.business_owner = #{query.businessOwner}
</if>
<if test="query.customerOwner != null and query.customerOwner != ''">
AND p.customer_owner LIKE CONCAT('%',#{query.customerOwner},'%')
</if>
<if test="query.startTime != null and query.startTime.length > 1">
AND p.start_time BETWEEN #{query.startTime[0]} AND #{query.startTime[1]}
</if>
<if test="query.endTime != null and query.endTime.length > 1">
AND p.end_time BETWEEN #{query.endTime[0]} AND #{query.endTime[1]}
</if>
<if test="query.createTime != null and query.createTime.length > 1">
AND p.create_time BETWEEN #{query.createTime[0]} AND #{query.createTime[1]}
</if>
<if test="query.status != null">
AND p.status = #{query.status}
</if>
<if test="query.envInfo != null and query.envInfo != ''">
AND p.env_info LIKE CONCAT('%',#{query.envInfo},'%')
</if>
<if test="query.serialNo != null and query.serialNo != ''">
AND CONCAT( c.`code`, p.`code` ) LIKE CONCAT('%',#{query.serialNo},'%')
</if>
<if test="query.technicalOwner != null">
AND (p.technical_owner_a = #{query.technicalOwner}
OR p.technical_owner_b = #{query.technicalOwner}
OR p.technical_owner_c = #{query.technicalOwner})
</if>
ORDER BY
p.id DESC
</select>
</mapper>