ims-server/src/main/resources/mapper/ApplyFormMapper.xml
my_ong 9039b3c731
All checks were successful
Release / Release (push) Successful in 43s
🐛 导出bug、型号的模糊查询
2025-03-25 20:36:51 +08:00

75 lines
2.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="tech.riemann.ims.mapper.material.ApplyFormMapper">
<resultMap id="resultMap" type="tech.riemann.ims.dto.response.ApplyDTO">
<id property="applyId" column="id" />
<result property="applyNum" column="ad_quantity" />
<result property="applyDate" column="af_apply_date" />
<result property="applicant" column="af_applicant" />
<result property="reviewer" column="af_reviewer" />
<result property="confirmNum" column="ad_confirm_quantity" />
<result property="type" column="m_type" />
<result property="code" column="m_code" />
<result property="name" column="m_name" />
<result property="spec" column="m_spec" />
<result property="applyType" column="af_type" />
<result property="remark" column="ad_exception_remark" />
<result property="confirm" column="af_is_confirm" />
<result property="reviewResult" column="af_review_result" />
</resultMap>
<select id="searchPage" resultMap="resultMap">
SELECT
f.id,
d.ad_quantity,
f.af_apply_date,
d.ad_exception_remark,
d.ad_confirm_quantity,
f.af_applicant,
f.af_reviewer,
m.m_type,
m.m_code,
m.m_name,
m.m_spec,
f.af_type,
f.af_is_confirm,
f.af_review_result
FROM
t_apply_form f
LEFT JOIN t_apply_detail d ON f.id = d.ad_apply_id
LEFT JOIN t_material m ON d.ad_material_id = m.id
WHERE 1 = 1
<if test="applyType!= null and applyType!= ''">
<choose>
<!-- <when test="applyType == '3'"> Mybatis会将 “2” 解析为字符类型-->
<when test='applyType == "1"'>
and f.af_type in ('1', '2')
</when>
<when test='applyType == "3"'>
and f.af_type in ('3', '5')
</when>
<otherwise>
and f.af_type = #{applyType}
</otherwise>
</choose>
</if>
<if test="types != null and types.size() > 0">
and (
<foreach collection="types" item="item" separator="or">
( m_type like concat(#{item},'%') )
</foreach>
)
</if>
<if test="key != null and key.trim().length() > 0">
and (
m_code like concat('%',#{key},'%')
or m_name like concat('%',#{key},'%')
or m_spec like concat('%',#{key},'%')
)
</if>
ORDER BY f.af_apply_date DESC
</select>
</mapper>