<?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.stylefeng.guns.modular.system.dao.FindMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Find">
|
<id column="id" property="id" />
|
<result column="userId" property="userId" />
|
<result column="insertTime" property="insertTime" />
|
<result column="likeCount" property="likeCount" />
|
<result column="title" property="title" />
|
<result column="content" property="content" />
|
<result column="img" property="img" />
|
<result column="video" property="video" />
|
<result column="isTop" property="isTop" />
|
<result column="isDelete" property="isDelete" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, userId, insertTime, likeCount, title, content, img, video, isTop, isDelete
|
</sql>
|
<select id="findList" resultType="com.stylefeng.guns.modular.system.vo.FindVO">
|
select t1.*,t2.name,t2.headImg,t2.clockIn
|
from t_find t1
|
left join t_user t2 on t1.userId = t2.id
|
<where>
|
<if test="item != null and item != ''">
|
AND (t1.title LIKE concat('%',#{item},'%') or
|
t2.name LIKE concat('%',#{item},'%'))
|
</if>
|
and t1.isDelete = 0
|
</where>
|
order by t1.isTop desc,t1.insertTime desc
|
</select>
|
<select id="selectFind" resultType="com.stylefeng.guns.modular.system.vo.FindVO">
|
SELECT t1.*, t2.name AS userName, t2.phone AS phone
|
FROM t_find t1
|
LEFT JOIN t_user t2 ON t1.userId = t2.id
|
<where>
|
t1.isDelete = 0
|
<if test="req.userName != null and req.userName != ''">
|
AND t2.name LIKE CONCAT('%', #{req.userName}, '%')
|
</if>
|
<if test="req.phone != null and req.phone != ''">
|
AND t2.phone LIKE CONCAT('%', #{req.phone}, '%')
|
</if>
|
<if test="req.title != null and req.title != ''">
|
AND t1.title LIKE CONCAT('%', #{req.title}, '%')
|
</if>
|
<if test="req.state != null">
|
AND t1.state = #{req.state}
|
</if>
|
<if test="req.isTop != null">
|
AND t1.isTop = #{req.isTop}
|
</if>
|
</where>
|
ORDER BY t1.isTop DESC, t1.insertTime DESC
|
</select>
|
</mapper>
|