Files
tuanwei-java/src/main/java/com/gxwebsoft/tower/mapper/xml/TowerProjectPlaceMapper.xml
2023-06-08 19:30:24 +08:00

51 lines
1.9 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.tower.mapper.TowerProjectPlaceMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*,b.name,b.place_code,b.place_id,b.equipment_type,b.type
FROM tower_project_place a
LEFT JOIN tower_place b ON a.place_id = b.place_id
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.projectId != null">
AND a.project_id = #{param.projectId}
</if>
<if test="param.placeId != null">
AND a.place_id = #{param.placeId}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</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 (
b.name LIKE CONCAT('%', #{param.keywords}, '%')
OR b.place_code LIKE CONCAT('%', #{param.keywords}, '%')
OR b.type LIKE CONCAT('%', #{param.keywords}, '%')
OR b.equipment_type LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.tower.entity.TowerProjectPlace">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.tower.entity.TowerProjectPlace">
<include refid="selectSql"></include>
</select>
</mapper>