|
@@ -0,0 +1,186 @@
|
|
|
|
+<?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.caimei365.manager.dao.user.ShopMapper">
|
|
|
|
+
|
|
|
|
+ <insert id="insertShop" parameterType="com.caimei365.manager.entity.caimei.CmShop" useGeneratedKeys="true" keyProperty="shopId">
|
|
|
|
+ INSERT INTO shop(userId,
|
|
|
|
+ name,
|
|
|
|
+ sname,
|
|
|
|
+ logo,
|
|
|
|
+ businessLicenseImage,
|
|
|
|
+ provinceID,
|
|
|
|
+ cityID,
|
|
|
|
+ townID,
|
|
|
|
+ address,
|
|
|
|
+ linkMan,
|
|
|
|
+ contractMobile,
|
|
|
|
+ info,
|
|
|
|
+ productDesc,
|
|
|
|
+ addTime,
|
|
|
|
+ status,
|
|
|
|
+ firstShopType,
|
|
|
|
+ secondShopType,
|
|
|
|
+ medicalPracticeLicenseImg1,
|
|
|
|
+ mainpro,
|
|
|
|
+ socialCreditCode,
|
|
|
|
+ shopType)
|
|
|
|
+ VALUES (#{userId},
|
|
|
|
+ #{name},
|
|
|
|
+ #{shortName},
|
|
|
|
+ #{logo},
|
|
|
|
+ #{businessLicenseImage},
|
|
|
|
+ #{provinceId},
|
|
|
|
+ #{cityId},
|
|
|
|
+ #{townId},
|
|
|
|
+ #{address},
|
|
|
|
+ #{linkMan},
|
|
|
|
+ #{contractMobile},
|
|
|
|
+ #{info},
|
|
|
|
+ #{productDesc},
|
|
|
|
+ now(),
|
|
|
|
+ #{status},
|
|
|
|
+ #{firstShopType},
|
|
|
|
+ #{secondShopType},
|
|
|
|
+ #{medicalPracticeLicenseImg1},
|
|
|
|
+ #{mainProduct},
|
|
|
|
+ #{socialCreditCode},
|
|
|
|
+ #{shopType})
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <update id="updateUserShopId">
|
|
|
|
+ update user set shopID = #{shopID}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="updateShop">
|
|
|
|
+ UPDATE shop
|
|
|
|
+ <set>
|
|
|
|
+ <if test="name != null and name != ''">
|
|
|
|
+ name = #{name},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="shortName != null and shortName != ''">
|
|
|
|
+ sname = #{shortName},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="logo != null and logo != ''">
|
|
|
|
+ logo = #{logo},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="businessLicenseImage != null and businessLicenseImage != ''">
|
|
|
|
+ businessLicenseImage = #{businessLicenseImage},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="address != null and address != ''">
|
|
|
|
+ address = #{address},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="linkMan != null and linkMan != ''">
|
|
|
|
+ linkMan = #{linkMan},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="contractMobile != null and contractMobile != ''">
|
|
|
|
+ contractMobile = #{contractMobile},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="info != null and info != ''">
|
|
|
|
+ info = #{info},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="productDesc != null and productDesc != ''">
|
|
|
|
+ productDesc = #{productDesc},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null and status != ''">
|
|
|
|
+ status = #{status},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="provinceId != null and provinceId != ''">
|
|
|
|
+ provinceID = #{provinceId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cityId != null and cityId != ''">
|
|
|
|
+ cityID = #{cityId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="townId != null and townId != ''">
|
|
|
|
+ townID = #{townId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="firstShopType != null and firstShopType != ''">
|
|
|
|
+ firstShopType=#{firstShopType},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="secondShopType != null and secondShopType != ''">
|
|
|
|
+ secondShopType=#{secondShopType},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="medicalPracticeLicenseImg1 != null and medicalPracticeLicenseImg1 != ''">
|
|
|
|
+ medicalPracticeLicenseImg1=#{medicalPracticeLicenseImg1},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="mainProduct != null and mainProduct != ''">
|
|
|
|
+ mainpro = #{mainProduct},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="socialCreditCode != null">
|
|
|
|
+ socialCreditCode = #{socialCreditCode}
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ WHERE shopID = #{shopId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="findShopList" resultType="com.caimei365.manager.entity.caimei.CmShop">
|
|
|
|
+ SELECT
|
|
|
|
+ a.shopID AS "shopId",
|
|
|
|
+ a.userID AS "userId",
|
|
|
|
+ a.name AS "name",
|
|
|
|
+ a.sname AS "shortName",
|
|
|
|
+ a.logo AS "logo",
|
|
|
|
+ a.businessLicenseImage AS "businessLicenseImage",
|
|
|
|
+ a.townID AS "townId",
|
|
|
|
+ d.provinceID AS "provinceId",
|
|
|
|
+ c.cityID AS "cityId",
|
|
|
|
+ a.address AS "address",
|
|
|
|
+ a.linkMan AS "linkMan",
|
|
|
|
+ a.contractMobile AS "contractMobile",
|
|
|
|
+ a.info AS "info",
|
|
|
|
+ a.addTime AS "addTime",
|
|
|
|
+ a.status AS "status",
|
|
|
|
+ a.firstShopType AS "firstShopType",
|
|
|
|
+ a.secondShopType AS "secondShopType",
|
|
|
|
+ a.socialCreditCode AS "socialCreditCode",
|
|
|
|
+ a.shopType AS "shopType"
|
|
|
|
+ FROM shop a
|
|
|
|
+ LEFT JOIN user u ON u.userID = a.userID
|
|
|
|
+ LEFT JOIN town b ON b.townID=a.townID
|
|
|
|
+ LEFT JOIN city c ON c.cityID=b.cityID
|
|
|
|
+ LEFT JOIN province d ON d.provinceID=c.provinceID
|
|
|
|
+ <where>
|
|
|
|
+ u.userOrganizeID = 5
|
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
|
+ AND a.name LIKE concat('%',#{shopName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="mobile != null and mobile != ''">
|
|
|
|
+ AND a.contractMobile = #{mobile}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ ORDER BY case when a.status = 91 then 0 else 1 end desc, a.shopID DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getShopForm" resultType="com.caimei365.manager.entity.caimei.CmShop">
|
|
|
|
+ SELECT
|
|
|
|
+ a.shopID AS "shopId",
|
|
|
|
+ a.userID AS "userId",
|
|
|
|
+ a.name AS "name",
|
|
|
|
+ a.sname AS "shortName",
|
|
|
|
+ a.logo AS "logo",
|
|
|
|
+ a.businessLicenseImage AS "businessLicenseImage",
|
|
|
|
+ a.townID AS "townId",
|
|
|
|
+ d.provinceID AS "provinceId",
|
|
|
|
+ c.cityID AS "cityId",
|
|
|
|
+ a.address AS "address",
|
|
|
|
+ a.linkMan AS "linkMan",
|
|
|
|
+ a.contractMobile AS "contractMobile",
|
|
|
|
+ a.info AS "info",
|
|
|
|
+ a.addTime AS "addTime",
|
|
|
|
+ a.status AS "status",
|
|
|
|
+ a.firstShopType AS "firstShopType",
|
|
|
|
+ a.secondShopType AS "secondShopType",
|
|
|
|
+ a.socialCreditCode AS "socialCreditCode",
|
|
|
|
+ a.shopType AS "shopType",
|
|
|
|
+ u.password as "password",
|
|
|
|
+ a.medicalPracticeLicenseImg1,
|
|
|
|
+ concat(d.name,'/',c.name,'/',b.name) as cityShopForm
|
|
|
|
+ FROM shop a
|
|
|
|
+ LEFT JOIN user u ON u.userID = a.userID
|
|
|
|
+ LEFT JOIN town b ON b.townID=a.townID
|
|
|
|
+ LEFT JOIN city c ON c.cityID=b.cityID
|
|
|
|
+ LEFT JOIN province d ON d.provinceID=c.provinceID
|
|
|
|
+ where a.shopId = #{shopId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+</mapper>
|