|  | @@ -11,6 +11,7 @@
 | 
	
		
			
				|  |  |          <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"/>
 | 
	
	
		
			
				|  | @@ -18,6 +19,13 @@
 | 
	
		
			
				|  |  |          <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="operator_time_" property="operatorTime"/>
 | 
	
		
			
				|  |  | +        <result column="operator_memo_" property="operatorMemo"/>
 | 
	
		
			
				|  |  | +        <result column="feedback_flag_" property="feedbackFlag"/>
 | 
	
		
			
				|  |  | +        <result column="handle_flag_" property="handleFlag"/>
 | 
	
		
			
				|  |  |      </resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 根据主键查询一条记录 -->
 | 
	
	
		
			
				|  | @@ -33,35 +41,36 @@
 | 
	
		
			
				|  |  |      <!-- 向数据库增加一条记录 -->
 | 
	
		
			
				|  |  |      <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_)
 | 
	
		
			
				|  |  | -        VALUES(#{mobileNo},#{title},#{content},#{userId},now(),#{clientType},#{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{url},#{tenantId})
 | 
	
		
			
				|  |  | +        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="url != null">
 | 
	
		
			
				|  |  | -                url_ = #{url},
 | 
	
		
			
				|  |  | +            <if test="operatorId != null">
 | 
	
		
			
				|  |  | +                operator_id_ = #{operatorId},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="clientType != null">
 | 
	
		
			
				|  |  | -                client_type_ = #{clientType},
 | 
	
		
			
				|  |  | +            <if test="operatorTime != null">
 | 
	
		
			
				|  |  | +                operator_time_ = #{operatorTime},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="userId != null">
 | 
	
		
			
				|  |  | -                user_id_ = #{userId},
 | 
	
		
			
				|  |  | +            <if test="operatorMemo != null">
 | 
	
		
			
				|  |  | +                operator_memo_ = #{operatorMemo},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="title != null">
 | 
	
		
			
				|  |  | -                title_ = #{title},
 | 
	
		
			
				|  |  | +            <if test="feedbackFlag != null">
 | 
	
		
			
				|  |  | +                feedback_flag_ = #{feedbackFlag},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="content != null">
 | 
	
		
			
				|  |  | -                content_ = #{content},
 | 
	
		
			
				|  |  | +            <if test="handleFlag != null">
 | 
	
		
			
				|  |  | +                handle_flag_ = #{handleFlag},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="mobileNo != null">
 | 
	
		
			
				|  |  | -                mobile_no_ = #{mobileNo},
 | 
	
		
			
				|  |  | -            </if>
 | 
	
		
			
				|  |  | -            <if test="type != null">
 | 
	
		
			
				|  |  | -                type_ = #{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | +            <if test="deviceNo != null">
 | 
	
		
			
				|  |  | +                device_no_ = #{deviceNo},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          </set>
 | 
	
		
			
				|  |  |          WHERE id_ = #{id} ans tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |      </update>
 | 
	
	
		
			
				|  | @@ -89,13 +98,31 @@
 | 
	
		
			
				|  |  |              <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="suggestionType != null and suggestionType != ''">
 | 
	
		
			
				|  |  | +                AND sut.type_ = #{suggestionType}
 | 
	
		
			
				|  |  | +            </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="id != null">
 | 
	
		
			
				|  |  | +                AND ss.id_ = #{id}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |      </sql>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 分页查询 -->
 | 
	
		
			
				|  |  |      <select id="queryPage" resultMap="SysSuggestion" parameterType="map">
 | 
	
		
			
				|  |  | -        SELECT ss.*,CASE WHEN ss.client_type_='STUDENT' THEN su.username_ ELSE su.real_name_ END username_ FROM sys_suggestion ss
 | 
	
		
			
				|  |  | +        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_
 | 
	
		
			
				|  |  |          <include refid="queryCondition" />
 | 
	
		
			
				|  |  |          ORDER BY ss.id_ DESC
 | 
	
		
			
				|  |  |          <include refid="global.limit"/>
 | 
	
	
		
			
				|  | @@ -107,4 +134,15 @@
 | 
	
		
			
				|  |  |          LEFT JOIN sys_user su ON su.id_ = ss.user_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>
 |