Files
mp-java/docs/bszx/mapper/xml/BszxBmMapper.xml
2025-08-09 17:18:30 +08:00

114 lines
4.4 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.gxwebsoft.bszx.mapper.BszxBmMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*,b.title as formName, c.name as branchName, u.phone as mobile,u.avatar,u.nickname
FROM bszx_bm a
LEFT JOIN cms_article b ON a.form_id = b.article_id
LEFT JOIN bszx_branch c ON a.branch_id = c.id
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.sex != null">
AND a.sex = #{param.sex}
</if>
<if test="param.phone != null">
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
</if>
<if test="param.branchId != null">
AND a.branch_id = #{param.branchId}
</if>
<if test="param.className != null">
AND a.class_name LIKE CONCAT('%', #{param.className}, '%')
</if>
<if test="param.gradeName != null">
AND a.grade_name LIKE CONCAT('%', #{param.gradeName}, '%')
</if>
<if test="param.address != null">
AND a.address LIKE CONCAT('%', #{param.address}, '%')
</if>
<if test="param.workUnit != null">
AND a.work_unit LIKE CONCAT('%', #{param.workUnit}, '%')
</if>
<if test="param.position != null">
AND a.position LIKE CONCAT('%', #{param.position}, '%')
</if>
<if test="param.present != null">
AND a.present = #{param.present}
</if>
<if test="param.age != null">
AND a.age = #{param.age}
</if>
<if test="param.number != null">
AND a.number = #{param.number}
</if>
<if test="param.extra != null">
AND a.extra LIKE CONCAT('%', #{param.extra}, '%')
</if>
<if test="param.certificate != null">
AND a.certificate LIKE CONCAT('%', #{param.certificate}, '%')
</if>
<if test="param.dateTime != null">
AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%')
</if>
<if test="param.formData != null">
AND a.form_data LIKE CONCAT('%', #{param.formData}, '%')
</if>
<if test="param.formId != null">
AND a.form_id = #{param.formId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
OR a.phone = #{param.keywords}
OR a.name LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.bszx.entity.BszxBm">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.bszx.entity.BszxBm">
<include refid="selectSql"></include>
</select>
</mapper>