Commit 26e8940ca256507301b252f8da5e5ea2b8c4406d

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