|
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.iformall.mapper.WxQuestionOneselfUserMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestionOneselfUser">
- <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="user_id" jdbcType="BIGINT" property="userId"/>
- <result column="user_name" jdbcType="VARCHAR" property="userName"/>
- <result column="user_sex" jdbcType="TINYINT" property="userSex"/>
- <result column="user_phone" jdbcType="VARCHAR" property="userPhone"/>
- <result column="question_id" jdbcType="BIGINT" property="questionId"/>
- <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`, `user_id`, `user_name`, `user_sex`, `user_phone`, `question_id`,
- `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 != userId ">
- and `user_id` = #{userId}
- </if>
-
- <if test=" null != userName ">
- and `user_name` like concat('%', #{userName},'%')
- </if>
-
- <if test=" null != userPhone ">
- and `user_phone` like concat('%', #{userPhone},'%')
- </if>
-
- <if test=" null != userSex ">
- and `user_sex` = #{userSex}
- </if>
-
- <if test=" null != questionId ">
- and `question_id` = #{questionId}
- </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.WxQuestionOneselfUser" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_question_oneself_user
- <include refid="dynamicWhereConditions"/>
- </select>
-
-
- <select id="countQuestion" parameterType="com.iformall.domain.po.WxQuestionOneselfUser" resultType="java.lang.Integer">
- select count(1)
- from wx_question_oneself_user
- where `user_id` = #{userId}
- and `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>
- </select>
-
- </mapper>
|