pull/8/head
cp 3 months ago
parent b742fd2d09
commit e716faeca9

@ -1,8 +1,8 @@
<?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.YishengDao">
<!-- 通用查询结果列 -->
<!-- 定义了一个 SQL 片段,包含了从数据库表中查询的列,将这些列别名为实体类中的属性名,方便结果映射 -->
<sql id="Base_Column_List">
a.id as id
,a.yisheng_uuid_number as yishengUuidNumber
@ -20,64 +20,77 @@
,a.yisheng_content as yishengContent
,a.create_time as createTime
</sql>
<!-- 定义一个查询方法id 为 "selectListView",参数类型为 Map返回类型为 com.entity.view.YishengView -->
<select id="selectListView" parameterType="map" resultType="com.entity.view.YishengView">
SELECT
<!-- 引入上面定义的通用查询结果列 SQL 片段 -->
<include refid="Base_Column_List" />
-- 级联表的字段
FROM yisheng a
<!-- 条件查询部分 -->
<where>
<!-- 如果参数中存在 "ids",并且其值不为空,构建 in 条件 -->
<if test="params.ids != null">
and a.id in
<foreach item="item" index="index" collection="params.ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 如果参数中 "yishengUuidNumber" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengUuidNumber != '' and params.yishengUuidNumber != null and params.yishengUuidNumber != 'null' ">
and a.yisheng_uuid_number like CONCAT('%',#{params.yishengUuidNumber},'%')
</if>
<!-- 如果参数中 "username" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.username != '' and params.username != null and params.username != 'null' ">
and a.username like CONCAT('%',#{params.username},'%')
</if>
<!-- 如果参数中 "password" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.password != '' and params.password != null and params.password != 'null' ">
and a.password like CONCAT('%',#{params.password},'%')
</if>
<!-- 如果参数中 "yishengName" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengName != '' and params.yishengName != null and params.yishengName != 'null' ">
and a.yisheng_name like CONCAT('%',#{params.yishengName},'%')
</if>
<!-- 如果参数中 "yishengTypes" 不为空且不为空字符串,构建等于条件 -->
<if test="params.yishengTypes != null and params.yishengTypes != ''">
and a.yisheng_types = #{params.yishengTypes}
</if>
<!-- 如果参数中 "zhiweiTypes" 不为空且不为空字符串,构建等于条件 -->
<if test="params.zhiweiTypes != null and params.zhiweiTypes != ''">
and a.zhiwei_types = #{params.zhiweiTypes}
</if>
<!-- 如果参数中 "yishengZhichneg" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengZhichneg != '' and params.yishengZhichneg != null and params.yishengZhichneg != 'null' ">
and a.yisheng_zhichneg like CONCAT('%',#{params.yishengZhichneg},'%')
</if>
<!-- 如果参数中 "yishengPhone" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengPhone != '' and params.yishengPhone != null and params.yishengPhone != 'null' ">
and a.yisheng_phone like CONCAT('%',#{params.yishengPhone},'%')
</if>
<!-- 如果参数中 "yishengGuahao" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengGuahao != '' and params.yishengGuahao != null and params.yishengGuahao != 'null' ">
and a.yisheng_guahao like CONCAT('%',#{params.yishengGuahao},'%')
</if>
<!-- 如果参数中 "yishengEmail" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengEmail != '' and params.yishengEmail != null and params.yishengEmail != 'null' ">
and a.yisheng_email like CONCAT('%',#{params.yishengEmail},'%')
</if>
<!-- 如果参数中 "yishengNewMoneyStart" 不为空,构建大于等于条件,使用 CDATA 防止特殊字符转义 -->
<if test="params.yishengNewMoneyStart != null ">
<![CDATA[ and a.yisheng_new_money >= #{params.yishengNewMoneyStart} ]]>
</if>
<!-- 如果参数中 "yishengNewMoneyEnd" 不为空,构建小于等于条件,使用 CDATA 防止特殊字符转义 -->
<if test="params.yishengNewMoneyEnd != null ">
<![CDATA[ and a.yisheng_new_money <= #{params.yishengNewMoneyEnd} ]]>
</if>
<!-- 如果参数中 "yishengContent" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengContent != '' and params.yishengContent != null and params.yishengContent != 'null' ">
and a.yisheng_content like CONCAT('%',#{params.yishengContent},'%')
</if>
</where>
<!-- 根据参数中的 "orderBy" 字段进行降序排序 -->
order by a.${params.orderBy} desc
</select>
</mapper>
Loading…
Cancel
Save