zhijiezhao 1 year ago
parent
commit
97bcec482d

+ 88 - 0
src/main/resources/mappings/modules/weisha/CmOrganizeStoreMapper.xml

@@ -2,6 +2,94 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.weisha.dao.CmOrganizeStoreDao">
 <mapper namespace="com.caimei.modules.weisha.dao.CmOrganizeStoreDao">
 
 
+    <sql id="cmOrganizeStoreColumns">
+        a.id AS "id",
+		a.organizeId AS "organizeId",
+		a.name AS "name",
+		a.linkMan AS "linkMan",
+		a.mobile AS "mobile",
+		a.provinceId AS "provinceId",
+		a.cityId AS "cityId",
+		a.townId AS "townId",
+		a.address AS "address",
+		a.status AS "status",
+		a.addTime AS "addTime"
+    </sql>
+    <sql id="cmOrganizeUserinfo">
+        u.userID AS userID,
+		c.clubID as clubID,
+		u.userOrganizeID AS organizeId,
+		c.name AS NAME,
+		c.linkMan AS linkMan,
+		c.contractMobile AS mobile,
+		c.provinceId AS provinceId,
+		c.cityId AS cityId,
+		c.townId AS townId,
+		c.address AS address,
+		c.status AS STATUS,
+		c.addTime AS ADDTIME
+    </sql>
+    <sql id="addressName">
+        p.name AS provinceName,
+		ct.name AS cityName,
+		t.name AS townName
+    </sql>
+
+    <sql id="cmOrganizeStoreJoins">
+        LEFT JOIN province p ON c.provinceId = p.provinceID
+		LEFT JOIN city ct ON c.cityId = ct.cityID
+		LEFT JOIN town t ON c.townId = t.townID
+    </sql>
+
+    <select id="findList" resultType="CmOrganizeStore">
+        SELECT
+        <include refid="cmOrganizeUserinfo"/>,
+        <include refid="addressName"/>
+        FROM USER u
+        LEFT JOIN club c ON c.userId = u.userId
+        <include refid="cmOrganizeStoreJoins"/>
+        <where>
+            <if test="name != null and name != ''">
+                AND c.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                AND c.linkMan LIKE
+                <if test="dbName == 'oracle'">'%'||#{linkMan}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{linkMan}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{linkMan},'%')</if>
+            </if>
+            <if test="mobile != null and mobile != ''">
+                AND c.contractMobile LIKE
+                <if test="dbName == 'oracle'">'%'||#{mobile}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{mobile}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{mobile},'%')</if>
+            </if>
+            <if test="status != null and status != ''">
+                AND c.status = #{status}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND c.addTime >= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND c.addTime <![CDATA[   <=  ]]> #{endTime}
+            </if>
+            <if test="organizeId != null">
+                and u.userOrganizeID = #{organizeId}
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by c.addTime desc
+            </otherwise>
+        </choose>
+    </select>
+
     <select id="getOrganizeUser" resultType="java.lang.Integer">
     <select id="getOrganizeUser" resultType="java.lang.Integer">
         SELECT DISTINCT userID
         SELECT DISTINCT userID
         FROM cm_mall_operation_user
         FROM cm_mall_operation_user