ims-server/src/main/resources/mapper/ApplyFormMapper.xml
2024-12-07 11:24:55 +08:00

57 lines
2.0 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">
<result property="applyNum" column="ad_quantity" />
<result property="applyDate" column="af_apply_date" />
<result property="applicant" column="af_applicant" />
<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" />
</resultMap>
<select id="searchPage" resultMap="resultMap">
SELECT
d.ad_quantity,
f.af_apply_date,
d.ad_exception_remark,
d.ad_confirm_quantity,
f.af_applicant,
m.m_type,
m.m_code,
m.m_name,
m.m_spec,
f.af_type
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 == '1'">
and f.af_type in ('1', '2')
</when>
<otherwise>
and f.af_type = #{applyType}
</otherwise>
</choose>
</if>
<if test="type!= null and type!= ''">
AND m.m_type = #{type}
</if>
<if test="code!= null and code!= ''">
AND m.m_code LIKE CONCAT('%', #{code}, '%')
</if>
<if test="name!= null and name!= ''">
AND m.m_name LIKE CONCAT('%', #{name}, '%')
</if>
ORDER BY f.af_apply_date DESC
</select>
</mapper>