123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <?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.ym.mec.biz.dal.dao.SysSuggestionDao">
- <resultMap type="com.ym.mec.biz.dal.entity.SysSuggestion" id="SysSuggestion">
- <result column="id_" property="id"/>
- <result column="mobile_no_" property="mobileNo"/>
- <result column="title_" property="title"/>
- <result column="content_" property="content"/>
- <result column="device_no_" property="deviceNo"/>
- <result column="url_" property="url"/>
- <result column="user_id_" property="userId"/>
- <result column="username_" property="username"/>
- <result column="create_time_" property="createTime"/>
- <result column="client_type_" property="clientType"/>
- <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="tenant_id_" property="tenantId"/>
- <result column="suggestion_type_" property="suggestionType"/>
- <result column="suggestionTypeName" property="suggestionTypeName"/>
- <result column="operator_id_" property="operatorId"/>
- <result column="operatorName" property="operatorName"/>
- <result column="operator_time_" property="operatorTime"/>
- <result column="operator_memo_" property="operatorMemo"/>
- <result column="feedback_flag_" property="feedbackFlag"/>
- <result column="handle_flag_" property="handleFlag"/>
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="SysSuggestion">
- SELECT * FROM sys_suggestion WHERE id_ = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="SysSuggestion">
- SELECT * FROM sys_suggestion where tenant_id_ = #{tenantId} ORDER BY id_
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysSuggestion" useGeneratedKeys="true" keyColumn="id"
- keyProperty="id">
- INSERT INTO sys_suggestion (mobile_no_,title_,content_,user_id_,create_time_,client_type_,type_,url_,tenant_id_,
- suggestion_type_,device_no_)
- VALUES(#{mobileNo},#{title},#{content},#{userId},now(),#{clientType},
- #{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{url},#{tenantId},
- #{suggestionType},#{deviceNo})
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.SysSuggestion">
- UPDATE sys_suggestion
- <set>
- <if test="operatorId != null">
- operator_id_ = #{operatorId},
- </if>
- <if test="operatorTime != null">
- operator_time_ = #{operatorTime},
- </if>
- <if test="operatorMemo != null">
- operator_memo_ = #{operatorMemo},
- </if>
- <if test="feedbackFlag != null">
- feedback_flag_ = #{feedbackFlag},
- </if>
- <if test="handleFlag != null">
- handle_flag_ = #{handleFlag},
- </if>
- <if test="deviceNo != null">
- device_no_ = #{deviceNo},
- </if>
- </set>
- WHERE id_ = #{id}
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete">
- DELETE FROM sys_suggestion WHERE id_ = #{id}
- </delete>
- <sql id="queryCondition">
- <where>
- ss.tenant_id_ = #{tenantId}
- <if test="type!=null">
- AND ss.type_ = #{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="clientType != null and clientType != ''">
- AND ss.client_type_ = #{clientType}
- </if>
- <if test="startTime!=null and startTime!=''">
- AND DATE_FORMAT(ss.create_time_,'%Y-%m-%d') >= #{startTime}
- </if>
- <if test="endTime!=null and endTime!=''">
- AND DATE_FORMAT(ss.create_time_,'%Y-%m-%d') <= #{endTime}
- </if>
- <if test="search != null and search != ''">
- AND (su.real_name_ LIKE CONCAT('%', #{search}, '%') OR su.username_ LIKE CONCAT('%', #{search}, '%') OR ss.user_id_=#{search} OR su.phone_=#{search})
- </if>
- <if test="operatorSearch != null and operatorSearch != ''">
- AND (sue.real_name_ LIKE CONCAT('%', #{operatorSearch}, '%') OR ss.operator_id_ = #{operatorSearch} OR sue.phone_ LIKE CONCAT('%', #{operatorSearch}, '%'))
- </if>
- <if test="suggestionType != null">
- AND ss.suggestion_type_ = #{suggestionType}
- </if>
- <if test="disposeFlag != null">
- <if test="disposeFlag == false">
- AND ss.operator_id_ IS NULL
- </if>
- <if test="disposeFlag == true">
- AND ss.operator_id_ IS NOT NULL
- </if>
- </if>
- <if test="handleFlag != null">
- AND ss.handle_flag_ = #{handleFlag}
- </if>
- <if test="feedbackFlag != null">
- AND ss.feedback_flag_ = #{feedbackFlag}
- </if>
- <if test="operatorId != null">
- AND ss.operator_id_ = #{operatorId}
- </if>
- <if test="userId != null">
- AND ss.user_id_ = #{userId}
- </if>
- <if test="id != null">
- AND ss.id_ = #{id}
- </if>
- </where>
- </sql>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="SysSuggestion" parameterType="map">
- SELECT ss.*,CASE WHEN ss.client_type_ IN ('STUDENT','SCHOOL') THEN su.username_ ELSE su.real_name_ END username_,
- sut.type_ suggestionTypeName,sue.real_name_ operatorName
- FROM sys_suggestion ss
- LEFT JOIN sys_user su ON su.id_ = ss.user_id_
- LEFT JOIN sys_user sue ON sue.id_ = ss.operator_id_
- left join sys_suggestion_type sut ON sut.id_ = ss.suggestion_type_
- <include refid="queryCondition" />
- ORDER BY ss.id_ DESC
- <include refid="global.limit"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(ss.id_) FROM sys_suggestion ss
- LEFT JOIN sys_user su ON su.id_ = ss.user_id_
- LEFT JOIN sys_user sue ON sue.id_ = ss.operator_id_
- <include refid="queryCondition" />
- </select>
- <select id="getDetail" resultMap="SysSuggestion">
- SELECT ss.*,CASE WHEN ss.client_type_='STUDENT' THEN su.username_ ELSE su.real_name_ END username_,
- sut.type_ suggestionTypeName
- FROM sys_suggestion ss
- LEFT JOIN sys_user su ON su.id_ = ss.user_id_
- left join sys_suggestion_type sut ON sut.id_ = ss.suggestion_type_
- WHERE ss.id_ = #{id}
- </select>
- <select id="countByTypeId" resultType="java.lang.Integer">
- select COUNT(0) from sys_suggestion where suggestion_type_ = #{suggestionTypeId}
- </select>
- </mapper>
|