Commit 26e8940ca256507301b252f8da5e5ea2b8c4406d

Authored by zhangxing
2 parents 699e884e 482e60c7
src/main/resources/mapping/com/diligrp/xtrade/product/CategoryDao.xml
... ... @@ -20,6 +20,15 @@
20 20 <if test="validDay != null"><![CDATA[valid_day = #{validDay},]]></if>
21 21 </set>
22 22 </sql>
  23 + <sql id="QUERY_WHERE_CLAUSE">
  24 + <where>
  25 + <if test="cname != null and cname != ''"><![CDATA[AND cname = #{cname}]]></if>
  26 + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if>
  27 + <if test="cateLevel != null "><![CDATA[AND cate_level = #{cateLevel}]]></if>
  28 + <if test="shortName != null and shortName != ''"><![CDATA[AND short_name = #{shortName}]]></if>
  29 + <if test="cateCode != null and cateCode != ''"><![CDATA[AND cate_code = #{cateCode}]]></if>
  30 + </where>
  31 + </sql>
23 32 <insert id="insert" parameterType="com.diligrp.xtrade.product.domain.entity.CategoryDo">
24 33 <![CDATA[
25 34 INSERT INTO `category`(`id`, `cateCode`, `cname`, `short_name`, `status`, `level`, `type`, `icon`, `image`, `valid_day`, `created_time`, `modified_time`, `market_id`) VALUES
... ... @@ -44,7 +53,6 @@
44 53 modify_date = now()
45 54 WHERE id = #{id}
46 55 ]]>
47   -
48 56 </update>
49 57 <update id="delect" parameterType="long">
50 58 <![CDATA[
... ... @@ -60,7 +68,4 @@
60 68 FROM `category` WHERE cate_code LIKE CONCAT(#{cateCode},"%");
61 69 ]]>
62 70 </select>
63   -
64   -
65   -
66 71 </mapper>
67 72 \ No newline at end of file
... ...
src/main/resources/mapping/com/diligrp/xtrade/product/MerchantDao.xml
... ... @@ -53,12 +53,7 @@
53 53 <if test="description != null and description != ''">
54 54 `description` = #{description},
55 55 </if>
56   - <if test="createdTime != null">
57   - created_time = #{createdTime},
58   - </if>
59   - <if test="modifiedTime != null">
60   - modified_time = #{modifiedTime},
61   - </if>
  56 + modified_time = now(),
62 57 </set>
63 58 </sql>
64 59  
... ... @@ -119,7 +114,7 @@
119 114 insert into xt_merchant(mer_id, mer_name, market_id, account_id, account_name, type, status, description,
120 115 created_time, modified_time)
121 116 values (#{merId}, #{merName}, #{marketId}, #{accountId}, #{accountName}, #{type}, #{status}, #{description},
122   - #{createdTime}, #{modifiedTime})
  117 + now(), now())
123 118 </insert>
124 119  
125 120 <!--通过主键修改数据-->
... ...
src/main/resources/mapping/com/diligrp/xtrade/product/ShopDao.xml
... ... @@ -21,6 +21,19 @@
21 21 <![CDATA[modify_date = now()]]>
22 22 </set>
23 23 </sql>
  24 + <sql id="QUERY_WHERE_CLAUSE">
  25 + <where>
  26 + <if test="shopId != null and shopId != ''"><![CDATA[AND shop_id = #{shopId}]]></if>
  27 + <if test="shopName != null and shopName != ''"><![CDATA[AND shop_name like CONCAT('%','${shopName}','%' )]]></if>
  28 + <if test="address != null and address != ''"><![CDATA[AND address = #{address}]]></if>
  29 + <if test="merId != null and merId != ''"><![CDATA[AND mer_id = #{merId}]]></if>
  30 + <if test="type != null and type != ''"><![CDATA[AND type = #{type}]]></if>
  31 + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if>
  32 + <if test="mainBiz != null and mainBiz != ''"><![CDATA[AND main_biz = #{mainBiz}]]></if>
  33 + <if test="selfShop != null and selfShop != ''"><![CDATA[AND self_shop = #{selfShop}]]></if>
  34 + </where>
  35 + </sql>
  36 +
24 37 <insert id="insert" parameterType="com.diligrp.xtrade.product.domain.entity.ShopDo">
25 38 <![CDATA[
26 39 INSERT INTO `xt_shop`(`id`, `shop_id`, `shop_name`, `self_shop`, `mer_id`, `main_biz`, `type`, `status`, `address`, `description`, `created_time`, `modified_time`)
... ... @@ -39,7 +52,7 @@
39 52 <update id="update" parameterType="com.diligrp.xtrade.product.domain.entity.ShopDo">
40 53 <![CDATA[UPDATE `xt_shop`]]>
41 54 <include refid="UPDATE_COLUMN_SET" />
42   - <![CDATA[WHERE mer_id = #{merId}]]>
  55 + <![CDATA[WHERE shop_id = #{shopId}]]>
43 56 </update>
44 57 <select id="selectByMerId" parameterType="long" resultType="com.diligrp.xtrade.product.domain.entity.ShopDo">
45 58 <![CDATA[
... ... @@ -50,13 +63,14 @@
50 63 FROM `xt_shop` WHERE mer_id = #{merId}
51 64 ]]>
52 65 </select>
53   - <select id="selectShop" parameterType="long" resultType="com.diligrp.xtrade.product.domain.dto.ShopQueryDto">
  66 + <select id="selectShop" parameterType="com.diligrp.xtrade.product.domain.dto.ShopQueryDto" resultType="com.diligrp.xtrade.product.domain.entity.ShopDo">
54 67 <![CDATA[
55 68 SELECT
56 69 ]]>
57 70 <include refid="QUERY_COLUMN_LIST" />
58 71 <![CDATA[
59   - FROM `xt_shop` WHERE mer_id = #{merId}
  72 + FROM `xt_shop`
60 73 ]]>
  74 + <include refid="QUERY_WHERE_CLAUSE" />
61 75 </select>
62 76 </mapper>
63 77 \ No newline at end of file
... ...