2025-06-05 23:45:30 +08:00

74 lines
3.3 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="com.dao.YaopinDao">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
a.id as id
,a.yaopin_name as yaopinName
,a.yaopin_types as yaopinTypes
,a.yaopin_kucun_number as yaopinKucunNumber
,a.danwei_types as danweiTypes
,a.yaopin_new_money as yaopinNewMoney
,a.yaopin_content as yaopinContent
,a.yaopin_delete as yaopinDelete
,a.create_time as createTime
</sql>
<select id="selectListView" parameterType="map" resultType="com.entity.view.YaopinView" >
SELECT
<include refid="Base_Column_List" />
-- 级联表的字段
FROM yaopin a
<where>
<if test="params.ids != null">
and a.id in
<foreach item="item" index="index" collection="params.ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test=" params.yaopinName != '' and params.yaopinName != null and params.yaopinName != 'null' ">
and a.yaopin_name like CONCAT('%',#{params.yaopinName},'%')
</if>
<if test="params.yaopinTypes != null and params.yaopinTypes != ''">
and a.yaopin_types = #{params.yaopinTypes}
</if>
<if test="params.yaopinKucunNumberStart != null and params.yaopinKucunNumberStart != ''">
<![CDATA[ and a.yaopin_kucun_number >= #{params.yaopinKucunNumberStart} ]]>
</if>
<if test="params.yaopinKucunNumberEnd != null and params.yaopinKucunNumberEnd != ''">
<![CDATA[ and a.yaopin_kucun_number <= #{params.yaopinKucunNumberEnd} ]]>
</if>
<if test="params.yaopinKucunNumber != null and params.yaopinKucunNumber != ''">
and a.yaopin_kucun_number = #{params.yaopinKucunNumber}
</if>
<if test="params.danweiTypes != null and params.danweiTypes != ''">
and a.danwei_types = #{params.danweiTypes}
</if>
<if test="params.yaopinNewMoneyStart != null ">
<![CDATA[ and a.yaopin_new_money >= #{params.yaopinNewMoneyStart} ]]>
</if>
<if test="params.yaopinNewMoneyEnd != null ">
<![CDATA[ and a.yaopin_new_money <= #{params.yaopinNewMoneyEnd} ]]>
</if>
<if test=" params.yaopinContent != '' and params.yaopinContent != null and params.yaopinContent != 'null' ">
and a.yaopin_content like CONCAT('%',#{params.yaopinContent},'%')
</if>
<if test="params.yaopinDeleteStart != null and params.yaopinDeleteStart != ''">
<![CDATA[ and a.yaopin_delete >= #{params.yaopinDeleteStart} ]]>
</if>
<if test="params.yaopinDeleteEnd != null and params.yaopinDeleteEnd != ''">
<![CDATA[ and a.yaopin_delete <= #{params.yaopinDeleteEnd} ]]>
</if>
<if test="params.yaopinDelete != null and params.yaopinDelete != ''">
and a.yaopin_delete = #{params.yaopinDelete}
</if>
</where>
order by a.${params.orderBy} desc
</select>
</mapper>