|
- <?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.iformall.mapper.WxQuestionOneselfTopicMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestionOneselfTopic">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="question_id" jdbcType="BIGINT" property="questionId"/>
- <result column="title" jdbcType="VARCHAR" property="title"/>
- <result column="answer" jdbcType="VARCHAR" property="answer"/>
- <result column="type" jdbcType="TINYINT" property="type"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="sort" jdbcType="INTEGER" property="sort"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`, `question_id`, `title`, `answer`, `type`,
- `create_date`,`update_date`,`sort`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where `del_status` = 1
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != questionId ">
- and `question_id` = #{questionId}
- </if>
-
- <if test=" null != title ">
- and `title` like concat('%', #{title},'%')
- </if>
-
- <if test=" null != type ">
- and `type` = #{type}
- </if>
-
- <if test=" null != startDate ">
- and `create_date` >= #{startDate}
- </if>
- <if test=" null != endDate ">
- and `create_date` <= #{endDate}
- </if>
-
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- <if test=" null == sortColumns">order by `sort`</if>
-
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxQuestionOneselfTopic" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_question_oneself_topic
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <delete id="deleteQuestionId" parameterType="com.iformall.domain.po.WxQuestionOneselfTopic">
- delete from wx_question_oneself_topic
- where question_id = #{questionId}
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- </delete>
-
- <insert id="insertList" parameterType="java.util.List">
- insert into wx_question_oneself_topic
- (`id`,`tenant_id`,`parent_tenant_id`, `question_id`, `title`, `answer`, `type`, `create_date`,`update_date`,`sort`)
- values
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.id,jdbcType=BIGINT},
- #{item.tenantId,jdbcType=VARCHAR},
- #{item.parentTenantId,jdbcType=VARCHAR},
- #{item.questionId,jdbcType=BIGINT},
- #{item.title,jdbcType=VARCHAR},
- #{item.answer,jdbcType=VARCHAR},
- #{item.type,jdbcType=TINYINT},
- #{item.createDate,jdbcType=TIMESTAMP},
- #{item.updateDate,jdbcType=TIMESTAMP},
- #{item.sort,jdbcType=INTEGER})
- </foreach>
- </insert>
-
- </mapper>
|