|
@@ -9,17 +9,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="getList" resultMap="BizCarrierResult" parameterType="cn.ezhizao.project.business.domain.BizCarrier">
|
|
|
- select t1.id,t1.category_id,t1.code,t1.qc_code,t1.remark,t1.tenant_id,t1.is_allow_more,COALESCE((SELECT t2.is_abandoned FROM biz_carrier_reject t2 WHERE t1.id = t2.carrier_id ORDER BY t2.create_time DESC LIMIT 1), 0) AS is_abandoned
|
|
|
+ select t1.id,t1.category_id,t1.code,t1.qc_code,t1.remark,t1.tenant_id,t1.is_allow_more,COALESCE((SELECT t3.is_abandoned FROM biz_carrier_reject t3 WHERE t1.id = t3.carrier_id ORDER BY t3.create_time DESC LIMIT 1), 0) AS is_abandoned
|
|
|
FROM biz_carrier t1
|
|
|
LEFT JOIN biz_carrier_category t2 ON t1.category_id = t2.id
|
|
|
<trim prefix=" WHERE" suffix="" suffixOverrides="AND">
|
|
|
- t1.deleted = 0 AND
|
|
|
- code =#{code}
|
|
|
- <if test="categoryId != null and categoryId != 0"> AND category_id = #{categoryId}</if>
|
|
|
- <if test="tenantId != null and tenantId != 0"> AND tenant_id = #{tenantId}</if>
|
|
|
+ t1.deleted = 0 AND t2.deleted = 0
|
|
|
+ and t1.code = #{code}
|
|
|
+<!-- and t1.code = COALESCE(#{code}, '0')-->
|
|
|
+ <if test="categoryId != null and categoryId != 0"> AND t1.category_id = #{categoryId}</if>
|
|
|
+ <if test="tenantId != null and tenantId != 0"> AND t1.tenant_id = #{tenantId}</if>
|
|
|
<if test="isInspection != null "> AND t2.is_inspection = #{isInspection}</if>
|
|
|
-<!-- <if test="code != null and code != ''"> AND code LIKE CONCAT('%', #{code}, '%')</if>-->
|
|
|
- <if test="isAbandoned != null"> AND is_abandoned = #{isAbandoned}</if>
|
|
|
<!-- 未关联任何生产单 -->
|
|
|
<if test="notInUse == 1">
|
|
|
AND not exists (select 1 from biz_daywork_carrier t where t.is_changed = 0 and t.carrier_id = t1.id)
|