123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <?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.caimei.mapper.cmMapper.AuthMapper">
- <insert id="insertAuth" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.caimei.model.po.CmBrandAuthPo">
- insert into cm_brand_auth (authUserId, authParty, provinceId, cityId, townId, address, lng, lat,
- mobile, userMobile, firstClubType, secondClubType, medicalLicenseImage, empNum,
- logo, customFlag, remarks, status, createTime, createBy, auditStatus, shopAuditStatus, delFlag)
- values (#{authUserId}, #{authParty}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{lng}, #{lat},
- #{mobile}, #{userMobile}, #{firstClubType}, #{secondClubType}, #{medicalLicenseImage}, #{empNum},
- #{logo}, #{customFlag}, #{remarks}, #{status}, NOW(), #{createBy}, #{auditStatus}, #{shopAuditStatus}, #{delFlag})
- </insert>
- <insert id="insertBanner">
- insert into cm_brand_auth_banner (authId, banner)
- VALUES (#{authId}, #{banner})
- </insert>
- <insert id="sendCertificate">
- insert into logistics_information (type, authId, nu, state, logisticsCompanyName, logisticsCompanyCode,
- updateDate, remarks, remarksImage)
- values (#{type}, #{authId}, #{logisticsNumber}, #{state}, #{companyName}, #{companyCode}, #{updateDate},
- #{remarks}, #{image})
- </insert>
- <update id="updateAuthStatusByAuthId">
- update cm_brand_auth
- set status = #{status}
- where id = #{authId}
- </update>
- <update id="updateAuthByAuthId">
- update cm_brand_auth
- set authParty = #{authParty},
- provinceId = #{provinceId},
- cityId = #{cityId},
- townId = #{townId},
- address = #{address},
- lng = #{lng},
- lat = #{lat},
- mobile = #{mobile},
- userMobile = #{userMobile},
- firstClubType = #{firstClubType},
- secondClubType = #{secondClubType},
- logo = #{logo},
- customFlag = #{customFlag},
- remarks = #{remarks},
- status = #{status},
- auditStatus = #{auditStatus},
- shopAuditStatus = #{shopAuditStatus}
- where id = #{id}
- </update>
- <update id="updateAuthAuditStatus">
- update cm_brand_auth
- set status = #{status},
- auditStatus = #{auditStatus},
- invalidReason = #{invalidReason},
- auditBy = #{auditBy},
- auditTime = #{auditTime}
- where id = #{authId}
- </update>
- <update id="deleteAuthByAuthId">
- update cm_brand_auth set delFlag = 1 where id = #{authId}
- </update>
- <update id="updateLdmLatestClubId">
- update ldm_latest_club_id set ldmClubId = #{ldmLatestClubId} where id = 1;
- </update>
- <update id="updateAuthShopAuditStatus">
- update cm_brand_auth
- set shopAuditStatus = #{shopAuditStatus},
- shopInvalidReason = #{shopInvalidReason},
- shopAuditTime = #{shopAuditTime}
- where id = #{authId}
- </update>
- <update id="updateSendStatus">
- update cm_brand_auth
- set sendStatus = 1
- where id = #{authId}
- </update>
- <delete id="deleteBanner">
- delete from cm_brand_auth_banner where authId = #{authId}
- </delete>
- <select id="getAuthList" resultType="com.caimei.model.vo.AuthVo">
- select id as authId, authParty, a.status, a.auditStatus, a.shopAuditStatus, a.createTime, cu.name as createBy,
- au.name as auditBy,a.auditTime,a.invalidReason,
- ifnull(ap.waitAuditNum,0) as waitAuditNum,
- ifnull(bp.waitAuditNum,0) as shopWaitAuditNum,
- if(ifnull(ap.waitAuditNum,0)>0,0,1) as lowerAuditStatus
- from cm_brand_auth a
- left join cm_brand_auth_user cu on a.createBy = cu.authUserId
- left join cm_brand_auth_user au on a.auditBy = au.authUserId
- left join (select authId,count(*) as waitAuditNum from cm_brand_auth_product where auditStatus = 2 group by
- authId) ap on a.id = ap.authId
- left join (select authId,count(*) as waitAuditNum from cm_brand_auth_product where shopAuditStatus = 2 group by
- authId) bp on a.id = bp.authId
- where a.authUserId = #{authUserId} and delFlag = 0
- <if test="authParty != null and authParty != ''">
- and a.authParty like CONCAT('%',#{authParty},'%')
- </if>
- <if test="status != null">
- and a.status = #{status}
- </if>
- <if test="auditStatus != null">
- and a.auditStatus = #{auditStatus}
- </if>
- <if test="1 == listType or 2 == listType">
- and a.shopAuditStatus = 1
- </if>
- <if test="4 == listType">
- and a.auditStatus = 1
- </if>
- <if test="shopAuditStatus != null">
- <if test="0 == shopAuditStatus">
- and (a.shopAuditStatus = 2 or ifnull(bp.waitAuditNum,0) > 0)
- </if>
- <if test="1 == shopAuditStatus">
- and (a.shopAuditStatus = 0 or a.shopAuditStatus = 1 or ifnull(bp.waitAuditNum,0) > 0)
- </if>
- </if>
- <if test="lowerAuditStatus != null">
- <if test="0 == lowerAuditStatus">
- and ifnull(ap.waitAuditNum,0) > 0
- </if>
- <if test="1 == lowerAuditStatus">
- and ifnull(ap.waitAuditNum,0) = 0
- </if>
- </if>
- <choose>
- <when test="listType == 2">
- order by (case a.auditStatus when 2 then 2 when 0 then 1 else 0 end) desc,waitAuditNum desc, a.createTime desc
- </when>
- <when test="listType == 3">
- order by (case a.shopAuditStatus when 2 then 2 when 0 then 1 else 0 end) desc,shopWaitAuditNum desc, a.createTime desc
- </when>
- <otherwise>
- order by a.createTime desc, a.id desc
- </otherwise>
- </choose>
- </select>
- <select id="getProductWaitAuditNum" resultType="java.lang.Integer">
- select count(*)
- from cm_brand_auth_product
- where authId = #{authId}
- and auditStatus = 2
- </select>
- <select id="getClubStatus" resultType="java.lang.Integer">
- select status
- from cm_brand_auth
- where id = #{authId}
- </select>
- <select id="getAuthIdByAuthParty" resultType="java.lang.Integer">
- select id
- from cm_brand_auth
- where authParty = #{authParty}
- and authUserId = #{authUserId}
- </select>
- <select id="getAuthPartyList" resultType="com.caimei.model.po.CmBrandAuthPo">
- select id, authParty
- from cm_brand_auth
- where authUserId = #{authUserId}
- order by createTime desc
- </select>
- <select id="getBannerList" resultType="java.lang.String">
- select banner from cm_brand_auth_banner where authId = #{authId}
- </select>
- <select id="getLdmData" resultType="com.caimei.model.po.LdmDataPo">
- select name as authParty,if(status = 1,1,0) as status,if(status = 1,1,0) as auditStatus,
- tel as mobile,addr as address,pic1,pic2,pic3,pic4,pic5,du as lngAndLat,
- if(deleted_at is null,0,1) as delFlag,regId1,regId2,regId3
- from nissan_ht_alcohol;
- </select>
- <select id="getProvinceId" resultType="java.lang.Integer">
- select provinceID
- from province
- where name like
- concat(#{provinceName},'%') limit 1;
- </select>
- <select id="getCityId" resultType="java.lang.Integer">
- select cityID
- from city
- where name like
- concat(#{cityName},'%') limit 1;
- </select>
- <select id="getTownId" resultType="java.lang.Integer">
- select townID
- from town
- where name like
- concat(#{townName},'%') limit 1;
- </select>
- <select id="getLdmLatestClubId" resultType="java.lang.Integer">
- select ldmClubId from ldm_latest_club_id where id = 1;
- </select>
- <select id="getCityIdByTownId" resultType="java.lang.Integer">
- select cityID from town where townID = #{townId}
- </select>
- <select id="getProvinceName" resultType="java.lang.String">
- select name from nissan_base_region1 where code = #{regId1} and level = 0 limit 1
- </select>
- <select id="getCityName" resultType="java.lang.String">
- select name from nissan_base_region1 where code = #{regId1} and level = 1 limit 1
- </select>
- <select id="getTownName" resultType="java.lang.String">
- select name from nissan_base_region1 where code = #{regId1} and level = 2 limit 1
- </select>
- <select id="getTownList" resultType="com.caimei.model.po.TownPo">
- select townID as townId, cityID as cityId
- from town
- where name like
- concat(#{townName},'%');
- </select>
- <select id="getProvinceIdByCityId" resultType="java.lang.Integer">
- select provinceID from city where cityID = #{cityId}
- </select>
- <select id="getAuthByUserMobile" resultType="com.caimei.model.vo.AuthFormVo">
- select id as authId, authParty
- from cm_brand_auth
- where authUserId = #{authUserId}
- and userMobile = #{mobile}
- </select>
- <select id="getAuthById" resultType="com.caimei.model.vo.AuthVo">
- select id as authId,
- a.authUserId,
- authParty,
- a.status,
- a.auditStatus,
- a.createTime,
- cu.name as createBy,
- au.name as auditBy,
- a.auditTime,
- a.invalidReason
- from cm_brand_auth a
- left join cm_brand_auth_user cu on a.createBy = cu.authUserId
- left join cm_brand_auth_user au on a.auditBy = au.authUserId
- where a.delFlag = 0
- and a.id = #{authId}
- </select>
- <select id="getAuthFormById" resultType="com.caimei.model.vo.AuthFormVo">
- select id as authId,
- authParty,
- authUserId,
- a.provinceId,
- a.cityId,
- a.townId,
- concat(p.name, '/', c.name, '/', t.name) as area,
- address,
- lng,
- lat,
- mobile,
- userMobile,
- firstClubType,
- secondClubType,
- medicalLicenseImage,
- empNum,
- logo,
- customFlag,
- remarks,
- status,
- auditStatus,
- shopAuditStatus,
- shopInvalidReason
- from cm_brand_auth a
- left join province p on a.provinceId = p.provinceID
- left join city c on a.cityId = c.cityID
- left join town t on a.townId = t.townID
- where id = #{authId}
- </select>
- </mapper>
|