|
- <?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.WxQuestionOneselfLogMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestionOneselfLog">
- <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="wqou_id" jdbcType="BIGINT" property="wqouId"/>
- <result column="topic_id" jdbcType="BIGINT" property="topicId"/>
- <result column="topic_title" jdbcType="VARCHAR" property="topicTitle"/>
- <result column="answer" jdbcType="VARCHAR" property="answer"/>
- <result column="answer_str" jdbcType="VARCHAR" property="answerStr"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`, `wqou_id`, `topic_id`, `topic_title`, `answer`, `answer_str`,
- `create_date`,`update_date`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 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 != wqouId ">
- and `wqou_id` = #{wqouId}
- </if>
-
- <if test=" null != topicId ">
- and `topic_id` = #{topicId}
- </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>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxQuestionOneselfLog" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_question_oneself_log
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findDetailsList" parameterType="com.iformall.domain.po.WxQuestionOneselfLog" resultType="com.iformall.domain.po.WxQuestionOneselfLog">
- select wqol.*,wqot.answer as answers,wqot.type,wqot.sort
- from wx_question_oneself_log wqol
- left join wx_question_oneself_topic wqot on wqot.id = wqol.topic_id
- where wqol.wqou_id = #{wqouId}
- <if test=" null != tenantId and '' != tenantId">
- and wqol.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and wqol.`parent_tenant_id` = #{parentTenantId}
- </if>
- order by wqot.sort
- </select>
-
- <insert id="insertList" parameterType="java.util.List">
- insert into wx_question_oneself_log
- (`id`,`tenant_id`,`parent_tenant_id`, `wqou_id`, `topic_id`, `topic_title`, `answer`, `answer_str`,`create_date`,`update_date`)
- values
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.id,jdbcType=BIGINT},
- #{item.tenantId,jdbcType=VARCHAR},
- #{item.parentTenantId,jdbcType=VARCHAR},
- #{item.wqouId,jdbcType=BIGINT},
- #{item.topicId,jdbcType=BIGINT},
- #{item.topicTitle,jdbcType=VARCHAR},
- #{item.answer,jdbcType=VARCHAR},
- #{item.answerStr,jdbcType=VARCHAR},
- #{item.createDate,jdbcType=TIMESTAMP},
- #{item.updateDate,jdbcType=TIMESTAMP})
- </foreach>
- </insert>
- </mapper>
|