You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
5.4 KiB
101 lines
5.4 KiB
<?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.chenhai.system.mapper.ConsultationFormsMapper">
|
|
|
|
<resultMap type="ConsultationForms" id="ConsultationFormsResult">
|
|
<result property="formId" column="form_id" />
|
|
<result property="farmerId" column="farmer_id" />
|
|
<result property="title" column="title" />
|
|
<result property="description" column="description" />
|
|
<result property="animalType" column="animal_type" />
|
|
<result property="images" column="images" />
|
|
<result property="status" column="status" />
|
|
<result property="isSensitive" column="is_sensitive" />
|
|
<result property="sensitiveWords" column="sensitive_words" />
|
|
<result property="viewCount" column="view_count" />
|
|
<result property="replyCount" column="reply_count" />
|
|
</resultMap>
|
|
|
|
<sql id="selectConsultationFormsVo">
|
|
select form_id, farmer_id, title, description, animal_type, images, status, is_sensitive, sensitive_words, view_count, reply_count from consultation_forms
|
|
</sql>
|
|
|
|
<select id="selectConsultationFormsList" parameterType="ConsultationForms" resultMap="ConsultationFormsResult">
|
|
<include refid="selectConsultationFormsVo"/>
|
|
<where>
|
|
<if test="farmerId != null "> and farmer_id = #{farmerId}</if>
|
|
<if test="title != null and title != ''"> and title = #{title}</if>
|
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
<if test="animalType != null and animalType != ''"> and animal_type = #{animalType}</if>
|
|
<if test="images != null and images != ''"> and images = #{images}</if>
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
<if test="isSensitive != null "> and is_sensitive = #{isSensitive}</if>
|
|
<if test="sensitiveWords != null and sensitiveWords != ''"> and sensitive_words = #{sensitiveWords}</if>
|
|
<if test="viewCount != null "> and view_count = #{viewCount}</if>
|
|
<if test="replyCount != null "> and reply_count = #{replyCount}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectConsultationFormsByFormId" parameterType="Long" resultMap="ConsultationFormsResult">
|
|
<include refid="selectConsultationFormsVo"/>
|
|
where form_id = #{formId}
|
|
</select>
|
|
|
|
<insert id="insertConsultationForms" parameterType="ConsultationForms" useGeneratedKeys="true" keyProperty="formId">
|
|
insert into consultation_forms
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="farmerId != null">farmer_id,</if>
|
|
<if test="title != null and title != ''">title,</if>
|
|
<if test="description != null and description != ''">description,</if>
|
|
<if test="animalType != null">animal_type,</if>
|
|
<if test="images != null">images,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="isSensitive != null">is_sensitive,</if>
|
|
<if test="sensitiveWords != null">sensitive_words,</if>
|
|
<if test="viewCount != null">view_count,</if>
|
|
<if test="replyCount != null">reply_count,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="farmerId != null">#{farmerId},</if>
|
|
<if test="title != null and title != ''">#{title},</if>
|
|
<if test="description != null and description != ''">#{description},</if>
|
|
<if test="animalType != null">#{animalType},</if>
|
|
<if test="images != null">#{images},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="isSensitive != null">#{isSensitive},</if>
|
|
<if test="sensitiveWords != null">#{sensitiveWords},</if>
|
|
<if test="viewCount != null">#{viewCount},</if>
|
|
<if test="replyCount != null">#{replyCount},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateConsultationForms" parameterType="ConsultationForms">
|
|
update consultation_forms
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="farmerId != null">farmer_id = #{farmerId},</if>
|
|
<if test="title != null and title != ''">title = #{title},</if>
|
|
<if test="description != null and description != ''">description = #{description},</if>
|
|
<if test="animalType != null">animal_type = #{animalType},</if>
|
|
<if test="images != null">images = #{images},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="isSensitive != null">is_sensitive = #{isSensitive},</if>
|
|
<if test="sensitiveWords != null">sensitive_words = #{sensitiveWords},</if>
|
|
<if test="viewCount != null">view_count = #{viewCount},</if>
|
|
<if test="replyCount != null">reply_count = #{replyCount},</if>
|
|
</trim>
|
|
where form_id = #{formId}
|
|
</update>
|
|
|
|
<delete id="deleteConsultationFormsByFormId" parameterType="Long">
|
|
delete from consultation_forms where form_id = #{formId}
|
|
</delete>
|
|
|
|
<delete id="deleteConsultationFormsByFormIds" parameterType="String">
|
|
delete from consultation_forms where form_id in
|
|
<foreach item="formId" collection="array" open="(" separator="," close=")">
|
|
#{formId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|