| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?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.goafanti.common.dao.DemandKeywordMapper" >
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.DemandKeyword" >
- <id column="id" property="id" jdbcType="VARCHAR" />
- <result column="demand_id" property="demandId" jdbcType="VARCHAR" />
- <result column="keyword" property="keyword" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, demand_id, keyword
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from demand_keyword
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
- delete from demand_keyword
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.DemandKeyword" >
- insert into demand_keyword (id, demand_id, keyword
- )
- values (#{id,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.DemandKeyword" >
- insert into demand_keyword
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="demandId != null" >
- demand_id,
- </if>
- <if test="keyword != null" >
- keyword,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="demandId != null" >
- #{demandId,jdbcType=VARCHAR},
- </if>
- <if test="keyword != null" >
- #{keyword,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.DemandKeyword" >
- update demand_keyword
- <set >
- <if test="demandId != null" >
- demand_id = #{demandId,jdbcType=VARCHAR},
- </if>
- <if test="keyword != null" >
- keyword = #{keyword,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.DemandKeyword" >
- update demand_keyword
- set demand_id = #{demandId,jdbcType=VARCHAR},
- keyword = #{keyword,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
-
- <insert id="insertBatch" parameterType="com.goafanti.common.model.DemandKeyword">
- insert into demand_keyword (id, demand_id, keyword)
- values
- <foreach item="item" index="index" collection="list" separator=",">
- (
- #{item.id,jdbcType=VARCHAR}, #{item.demandId,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
-
- <delete id="batchDeleteByDemandId" parameterType="java.lang.String">
- delete from demand_keyword where demand_id = #{demandId,jdbcType=VARCHAR}
- </delete>
-
- <delete id="batchDeleteByDemandIds" parameterType="java.util.List">
- delete from demand_keyword where demand_id in
- <foreach item="item" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
-
- <select id="selectKeywordsByDemandId" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- keyword from demand_keyword where demand_id = #{id,jdbcType=VARCHAR}
- </select>
-
- <select id="selectAchievementDemand" resultType="com.goafanti.common.model.AchievementDemand">
- select count(dk.demand_id), dk.demand_id as demandId
- from demand_keyword dk
- left join demand d on d.id = dk.demand_id
- where d.audit_status = 3 and d.deleted_sign = 0 and dk.keyword in
- <foreach item="item" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- group by dk.demand_id
- order by count(dk.demand_id) desc
- LIMIT 20
- </select>
- </mapper>
|