123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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.kmall.admin.dao.HelpIssueDao">
- <resultMap type="com.kmall.admin.entity.HelpIssueEntity" id="helpIssueMap">
- <result property="id" column="id"/>
- <result property="typeId" column="type_id"/>
- <result property="question" column="question"/>
- <result property="answer" column="answer"/>
- <result property="sort" column="sort"/>
- <result property="merchSn" column="merch_sn"/>
- <result property="storeId" column="store_id"/>
- <result property="storeName" column="store_name"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.HelpIssueEntity">
- select
- `id`,
- `type_id`,
- `question`,
- `answer`,
- `merch_sn`,
- `store_id`,
- `sort`
- from mall_help_issue
- where id = #{id}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.HelpIssueEntity">
- select
- h.id,
- h.type_id,
- h.question,
- h.answer,
- h.sort,
- t.type_name,
- h.merch_sn,
- h.store_id,
- s.store_name
- from mall_help_issue h left join mall_store s on h.store_id = s.id
- LEFT JOIN mall_help_type t ON h.type_id = t.id
- WHERE 1=1
- <if test="storeId != null and storeId != '' ">
- AND h.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != '' ">
- AND h.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="typeName != null and typeName.trim() != ''">
- AND t.type_name LIKE concat('%',#{typeName},'%')
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by type_id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
-
- <select id="queryTotal" resultType="int">
- select count(*) from mall_help_issue h
- LEFT JOIN mall_help_type on h.type_id = mall_help_type.id
- left join mall_store s on h.store_id = s.id
- WHERE 1=1
- <if test="storeId != null and storeId != '' ">
- AND h.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != '' ">
- AND h.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="typeName != null and typeName.trim() != ''">
- AND h.type_name LIKE concat('%',#{typeName},'%')
- </if>
- </select>
-
- <insert id="save" parameterType="com.kmall.admin.entity.HelpIssueEntity" useGeneratedKeys="true" keyProperty="id">
- insert into mall_help_issue(
- `type_id`,
- `question`,
- `answer`,
- `merch_sn`,
- `store_id`,
- `sort`)
- values(
- #{typeId},
- #{question},
- #{answer},
- #{merchSn},
- #{storeId},
- #{sort})
- </insert>
-
- <update id="update" parameterType="com.kmall.admin.entity.HelpIssueEntity">
- update mall_help_issue
- <set>
- <if test="typeId != null">`type_id` = #{typeId}, </if>
- <if test="question != null">`question` = #{question}, </if>
- <if test="answer != null">`answer` = #{answer}, </if>
- <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
- <if test="storeId != null">`store_id` = #{storeId}, </if>
- <if test="sort != null">`sort` = #{sort}</if>
- </set>
- where id = #{id}
- </update>
-
- <delete id="delete">
- delete from mall_help_issue where id = #{value}
- </delete>
-
- <delete id="deleteBatch">
- delete from mall_help_issue where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|