| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.other.mapper.ShopPointMapper"> |
| | | |
| | | <select id="findLatestChangeByType" resultType="com.ruoyi.other.api.domain.ShopPoint"> |
| | | <sql id="ShopPointList"> |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_point, |
| | | variable_point, |
| | | create_time, |
| | | create_user_id, |
| | | object_id |
| | | ts.`name` shopName, |
| | | ts.shop_manager shopLeaderName, |
| | | ts.phone, |
| | | tsp.type, |
| | | tsp.create_time, |
| | | tsp.variable_point |
| | | FROM |
| | | ( |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_point, |
| | | variable_point, |
| | | create_time, |
| | | create_user_id, |
| | | object_id, |
| | | ROW_NUMBER() OVER ( PARTITION BY type,create_user_id ORDER BY create_time DESC ) AS rn |
| | | FROM |
| | | t_shop_point |
| | | t_shop_point tsp |
| | | LEFT JOIN t_shop ts ON tsp.shop_id = ts.id |
| | | <where> |
| | | <if test="shopPoint.shopName != null and shopPoint.shopName != ''"> |
| | | AND ts.`name` LIKE concat('%',#{shopPoint.shopName},'%') |
| | | </if> |
| | | <if test="shopPoint.shopLeaderName != null and shopPoint.shopLeaderName != ''"> |
| | | AND ts.shop_manager LIKE concat('%',#{shopPoint.shopLeaderName},'%') |
| | | </if> |
| | | <if test="shopPoint.phone != null and shopPoint.phone != ''"> |
| | | AND ts.phone LIKE concat('%',#{shopPoint.phone},'%') |
| | | </if> |
| | | <if test="shopPoint.type != null"> |
| | | AND tsp.type = #{shopPoint.type} |
| | | </if> |
| | | <if test="shopPoint.startTime !=null and shopPoint.endTime !=null"> |
| | | AND tsp.create_time BETWEEN #{shopPoint.startTime} AND #{shopPoint.endTime} |
| | | </if> |
| | | |
| | | <where> |
| | | <if test="shopIds != null and shopIds.size() > 0"> |
| | | AND shop_id IN |
| | | <foreach collection="shopIds" item="shopId" open="(" close=")" separator=","> |
| | | #{shopId} |
| | | </foreach> |
| | | </if> |
| | | <if test="type != null"> |
| | | AND `type` = #{type} |
| | | </if> |
| | | <if test="startTime != null and endTime != null"> |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | </where> |
| | | ) AS subquery |
| | | WHERE |
| | | rn = 1 |
| | | </where> |
| | | </sql> |
| | | |
| | | <select id="selectShopPointList" resultType="com.ruoyi.other.api.domain.ShopPoint"> |
| | | <include refid="ShopPointList"/> |
| | | </select> |
| | | <select id="queryShpointPage" resultType="com.ruoyi.other.api.domain.ShopPoint"> |
| | | <include refid="ShopPointList"/> |
| | | </select> |
| | | </mapper> |