12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?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.ruoyi.demo.mapper.AttentionPoolDao">
- <resultMap type="com.ruoyi.demo.entity.AttentionPool" id="AttentionPoolResult">
- <result property="attentionId" column="attention_id"/>
- <result property="contact" column="contact"/>
- <result property="telephone" column="telephone"/>
- <result property="brandId" column="brand_id"/>
- <result property="brandName" column="brand_name"/>
- <result property="wdId" column="wd_id"/>
- <result property="wdName" column="wd_name"/>
- <result property="wdAddrInfo" column="wd_addr_info"/>
- <result property="userId" column="user_id"/>
- <result property="attentionTime" column="attention_time"/>
- </resultMap>
- <delete id="deleteByAttentionIdAndUserId">
- delete from `bl_attention_pool`
- <trim prefix="where" prefixOverrides="and">
- <if test="userId != null">
- user_id = #{userId}
- </if>
- and attention_id = #{attentionId}
- </trim>
- </delete>
- <delete id="deleteByBrandIdOrWdIdAndUserId">
- delete from `bl_attention_pool` where user_id = #{userId}
- <if test="brandId != null">
- and brand_id = #{brandId} and wd_id = ''
- </if>
- <if test="wdId != null">
- and wd_id = #{wdId}
- </if>
- </delete>
- <select id="searchByMulti" resultMap="AttentionPoolResult">
- select * from `bl_attention_pool`
- <trim prefix="where" prefixOverrides="and">
- <if test="userId != null">
- user_id = #{userId}
- </if>
- <if test="text != null">
- and (
- contact like concat('%',#{text},'%')
- or telephone like concat('%',#{text},'%')
- or wd_name like concat('%',#{text},'%')
- or wd_addr_info like concat('%',#{text},'%')
- or brand_name like concat('%',#{text},'%')
- )
- </if>
- </trim>
- order by attention_time desc
- </select>
- <select id="searchCountByUserId" resultType="java.lang.Integer">
- select count(*) from `bl_attention_pool`
- <where>
- <if test="userId != null">
- user_id = #{userId}
- </if>
- </where>
- </select>
- <select id="searchByBrandIdOrWdIdAndUserId" resultMap="AttentionPoolResult">
- select * from `bl_attention_pool` where user_id = #{userId}
- <if test="brandId != null">
- and brand_id = #{brandId} and wd_id = ''
- </if>
- <if test="wdId != null">
- and wd_id = #{wdId}
- </if>
- </select>
- <select id="searchByAttentionIdAndUserId" resultMap="AttentionPoolResult">
- select * from `bl_attention_pool`
- <trim prefix="where" prefixOverrides="and">
- <if test="userId != null">
- user_id = #{userId}
- </if>
- and attention_id = #{attentionId}
- </trim>
- </select>
- <select id="selectAllUser" resultType="java.lang.String">
- SELECT DISTINCT
- user_id
- FROM
- `bl_attention_pool`;
- </select>
- <select id="selectCount" resultType="java.lang.Integer">
- SELECT
- COUNT(*) count
- FROM
- `bl_attention_pool`
- WHERE
- user_id = #{userId}
- </select>
- </mapper>
|