123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <?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.FreightDao">
- <resultMap type="com.kmall.admin.entity.FreightEntity" id="freightMap">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="storeId" column="store_id"/>
- <result property="merchSn" column="merch_sn"/>
- <result property="templateType" column="template_type"/>
- <result property="pricingManner" column="pricing_manner"/>
- <result property="defaultFreight" column="default_freight"/>
- <result property="isDefault" column="is_default"/>
- <result property="storeName" column="storeName"/>
- <result column="merchName" property="merchName" />
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.FreightEntity">
- select
- `id`,
- `name`,
- `store_id`,
- `merch_sn`,
- `template_type`,
- `pricing_manner`,
- `default_freight`,
- `is_default`
- from mall_freight
- where id = #{id}
- </select>
- <select id="queryObjectByName" resultType="com.kmall.admin.entity.FreightEntity">
- select
- `id`,
- `name`,
- `store_id`,
- `merch_sn`,
- `template_type`,
- `pricing_manner`,
- `default_freight`,
- `is_default`
- from mall_freight
- where default_freight = #{defaultFreight}
- <if test="merchSn != null and merchSn.trim() != ''">
- AND merch_sn = #{merchSn}
- </if>
- </select>
- <select id="queryObjectByStoreId" resultType="com.kmall.admin.entity.FreightEntity">
- select
- `id`,
- `name`,
- `store_id`,
- `merch_sn`,
- `template_type`,
- `pricing_manner`,
- `default_freight`,
- `is_default`
- from mall_freight
- where store_id = #{storeId}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.FreightEntity">
- select
- b.id,
- b.name,
- b.store_id,
- b.merch_sn,
- `template_type`,
- `pricing_manner`,
- `default_freight`,
- `is_default`,
- s.store_name storeName,
- m.merch_name merchName
- from mall_freight b
- left join mall_store s on b.store_id = s.id
- left join mall_merch m on b.merch_sn = m.merch_sn
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND b.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND b.merch_sn = #{merchSn}
- </if>
- <if test="name != null and name.trim() != ''">
- AND b.name LIKE concat('%',#{name},'%')
- </if>
- <if test="id != null and id != ''">
- AND b.id LIKE concat('%',#{id},'%')
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by b.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryEntity" resultType="com.kmall.admin.entity.FreightEntity">
- select
- `id`,
- `name`,
- `store_id`,
- `merch_sn`,
- `template_type`,
- `pricing_manner`,
- `default_freight`,
- `is_default`
- from mall_freight
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND merch_sn = #{merchSn}
- </if>
- <if test="name != null and name != ''">
- AND name LIKE concat('%',#{name},'%')
- </if>
- <if test="id != null and id != ''">
- AND id NOT LIKE concat('%',#{id},'%')
- </if>
- <choose>
- <when test="sidx != null and sidx != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by 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_freight
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND merch_sn = #{merchSn}
- </if>
- <if test="name != null and name.trim() != ''">
- AND name LIKE concat('%',#{name},'%')
- </if>
- <if test="id != null and id != ''">
- AND id NOT LIKE concat('%',#{id},'%')
- </if>
- </select>
-
- <insert id="save" parameterType="com.kmall.admin.entity.FreightEntity" useGeneratedKeys="true" keyProperty="id">
- insert into mall_freight(
- `name`,
- `store_id`,
- `merch_sn`,
- `template_type`,
- `pricing_manner`,
- `default_freight`,
- `is_default`)
- values(
- #{name},
- #{storeId},
- #{merchSn},
- #{templateType},
- #{pricingManner},
- #{defaultFreight},
- #{isDefault})
- </insert>
-
- <update id="update" parameterType="com.kmall.admin.entity.FreightEntity">
- update mall_freight
- <set>
- <if test="name != null">`name` = #{name}, </if>
- <if test="storeId != null">`store_id` = #{storeId}, </if>
- <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
- <if test="templateType != null">`template_type` = #{templateType}, </if>
- <if test="pricingManner != null">`pricing_manner` = #{pricingManner}, </if>
- <if test="defaultFreight != null">`default_freight` = #{defaultFreight},</if>
- <if test="isDefault != null">`is_default` = #{isDefault}</if>
- </set>
- where id = #{id}
- </update>
-
- <delete id="delete">
- delete from mall_freight where id = #{value}
- </delete>
-
- <delete id="deleteBatch">
- delete from mall_freight where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="queryMaxId" resultType="java.lang.Integer" parameterType="map">
- SELECT MAX(id) FROM mall_freight
- </select>
- </mapper>
|