|
- <?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.WxQuestionOneselfMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestionOneself">
- <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="logo" jdbcType="VARCHAR" property="logo"/>
- <result column="top_pic" jdbcType="VARCHAR" property="topPic"/>
- <result column="title" jdbcType="VARCHAR" property="title"/>
- <result column="top_desc" jdbcType="VARCHAR" property="topDesc"/>
- <result column="status" jdbcType="TINYINT" property="status"/>
- <result column="start_date" jdbcType="TIMESTAMP" property="startDate"/>
- <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/>
- <result column="reward_credit" jdbcType="INTEGER" property="rewardCredit"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="sort" jdbcType="INTEGER" property="sort"/>
- <result column="count_topic" jdbcType="INTEGER" property="countTopic"/>
- <result column="count_user" jdbcType="INTEGER" property="countUser"/>
- <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`, `logo`, `top_pic`, `title`, `top_desc`, `status`, `start_date`, `end_date`,
- `reward_credit`,`create_date`,`update_date`,`sort`, `qr_code`, `count_topic`, `count_user`
- </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 != title ">
- and `title` like concat('%', #{title},'%')
- </if>
-
- <if test=" null != status and status lt 3">
- and `status` = #{status}
- </if>
-
- <if test=" null != status and status == 3">
- and `status` >= 2 and `status` <= 3
- </if>
-
- <if test=" null != status and status == 4">
- and `status` > 0
- </if>
-
- <if test=" null != createStartdate ">
- and `create_date` >= #{createStartdate}
- </if>
- <if test=" null != createEnddate ">
- and `create_date` <= #{createEnddate}
- </if>
-
- <if test=" null != startStartdate ">
- and `start_date` >= #{startStartdate}
- </if>
- <if test=" null != startEnddate ">
- and `start_date` <= #{startEnddate}
- </if>
-
- <if test=" null != endStartdate ">
- and `end_date` >= #{endStartdate}
- </if>
- <if test=" null != endEnddate ">
- and `end_date` <= #{endEnddate}
- </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.WxQuestionOneself" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_question_oneself
- <include refid="dynamicWhereConditions"/>
- </select>
-
-
- <update id="updateCountUser" parameterType="Long">
- update wx_question_oneself set count_user = count_user+1
- where id = #{id}
- </update>
-
- </mapper>
|