112 lines
6.4 KiB
XML
112 lines
6.4 KiB
XML
<?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.bonus.canteen.core.basic.mapper.BasicCanteenSuggestionMapper">
|
|
<resultMap type="com.bonus.canteen.core.basic.domain.BasicCanteenSuggestion" id="BasicCanteenSuggestionResult">
|
|
<result property="suggestionId" column="suggestion_id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="content" column="content" />
|
|
<result property="canteenId" column="canteen_id" />
|
|
<result property="canteenName" column="canteen_name" />
|
|
<result property="contactTel" column="contact_tel" />
|
|
<result property="replyContent" column="reply_content" />
|
|
<result property="replyState" column="reply_state" />
|
|
<result property="replyUserId" column="reply_user_id" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectBasicCanteenSuggestionVo">
|
|
select bcs.suggestion_id, bcs.user_id, bcs.content, bcs.canteen_id, bcs.contact_tel, bcs.reply_content,
|
|
bcs.reply_state, bcs.reply_user_id, su.nick_name as create_by, bcs.create_time, bcs.update_by, bcs.update_time,
|
|
bc.canteen_name
|
|
from basic_canteen_suggestion bcs
|
|
left join basic_canteen bc on bc.canteen_id = bcs.canteen_id
|
|
left join sys_user su on su.user_id = bcs.user_id
|
|
</sql>
|
|
|
|
<select id="selectBasicCanteenSuggestionList" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteenSuggestion" resultMap="BasicCanteenSuggestionResult">
|
|
<include refid="selectBasicCanteenSuggestionVo"/>
|
|
<where>
|
|
<if test="userId != null "> and bcs.user_id = #{userId}</if>
|
|
<if test="content != null and content != ''"> and bcs.content like concat('%', #{content}, '%')</if>
|
|
<if test="canteenId != null "> and bcs.canteen_id = #{canteenId}</if>
|
|
<if test="contactTel != null and contactTel != ''"> and bcs.contact_tel = #{contactTel}</if>
|
|
<if test="replyContent != null and replyContent != ''"> and bcs.reply_content = #{replyContent}</if>
|
|
<if test="replyState != null "> and bcs.reply_state = #{replyState}</if>
|
|
<if test="replyUserId != null "> and bcs.reply_user_id = #{replyUserId}</if>
|
|
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
|
|
and bcs.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime},' 23:59:59')
|
|
</if>
|
|
</where>
|
|
order by bcs.create_time desc
|
|
</select>
|
|
|
|
<select id="selectBasicCanteenSuggestionBySuggestionId" parameterType="Long" resultMap="BasicCanteenSuggestionResult">
|
|
<include refid="selectBasicCanteenSuggestionVo"/>
|
|
where suggestion_id = #{suggestionId}
|
|
</select>
|
|
|
|
<insert id="insertBasicCanteenSuggestion" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteenSuggestion" useGeneratedKeys="true" keyProperty="suggestionId">
|
|
insert into basic_canteen_suggestion
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="content != null and content != ''">content,</if>
|
|
<if test="canteenId != null">canteen_id,</if>
|
|
<if test="contactTel != null">contact_tel,</if>
|
|
<if test="replyContent != null">reply_content,</if>
|
|
<if test="replyState != null">reply_state,</if>
|
|
<if test="replyUserId != null">reply_user_id,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="content != null and content != ''">#{content},</if>
|
|
<if test="canteenId != null">#{canteenId},</if>
|
|
<if test="contactTel != null">#{contactTel},</if>
|
|
<if test="replyContent != null">#{replyContent},</if>
|
|
<if test="replyState != null">#{replyState},</if>
|
|
<if test="replyUserId != null">#{replyUserId},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateBasicCanteenSuggestion" parameterType="com.bonus.canteen.core.basic.domain.BasicCanteenSuggestion">
|
|
update basic_canteen_suggestion
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="content != null and content != ''">content = #{content},</if>
|
|
<if test="canteenId != null">canteen_id = #{canteenId},</if>
|
|
<if test="contactTel != null">contact_tel = #{contactTel},</if>
|
|
<if test="replyContent != null">reply_content = #{replyContent},</if>
|
|
<if test="replyState != null">reply_state = #{replyState},</if>
|
|
<if test="replyUserId != null">reply_user_id = #{replyUserId},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where suggestion_id = #{suggestionId}
|
|
</update>
|
|
|
|
<delete id="deleteBasicCanteenSuggestionBySuggestionId" parameterType="Long">
|
|
delete from basic_canteen_suggestion where suggestion_id = #{suggestionId}
|
|
</delete>
|
|
|
|
<delete id="deleteBasicCanteenSuggestionBySuggestionIds" parameterType="String">
|
|
delete from basic_canteen_suggestion where suggestion_id in
|
|
<foreach item="suggestionId" collection="array" open="(" separator="," close=")">
|
|
#{suggestionId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|