Files
zxjp-web/coolstore-partner-dao/src/main/resources/mapper/StoreMapper.xml

193 lines
8.7 KiB
XML

<?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.cool.store.mapper.StoreMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.StoreDO">
<!--
WARNING - @mbggenerated
-->
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="store_id" property="storeId" jdbcType="VARCHAR"/>
<result column="store_name" property="storeName" jdbcType="VARCHAR"/>
<result column="store_num" property="storeNum" jdbcType="VARCHAR"/>
<result column="store_address" property="storeAddress" jdbcType="VARCHAR"/>
<result column="location_address" property="locationAddress" jdbcType="VARCHAR"/>
<result column="is_lock" property="isLock" jdbcType="CHAR"/>
<result column="longitude_latitude" property="longitudeLatitude" jdbcType="VARCHAR"/>
<result column="longitude" property="longitude" jdbcType="VARCHAR"/>
<result column="latitude" property="latitude" jdbcType="VARCHAR"/>
<result column="is_delete" property="isDelete" jdbcType="CHAR"/>
<result column="telephone" property="telephone" jdbcType="VARCHAR"/>
<result column="business_hours" property="businessHours" jdbcType="VARCHAR"/>
<result column="store_acreage" property="storeAcreage" jdbcType="VARCHAR"/>
<result column="store_bandwidth" property="storeBandwidth" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="BIGINT"/>
<result column="create_name" property="createName" jdbcType="VARCHAR"/>
<result column="create_user" property="createUser" jdbcType="VARCHAR"/>
<result column="update_time" property="updateTime" jdbcType="BIGINT"/>
<result column="update_name" property="updateName" jdbcType="VARCHAR"/>
<result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
<result column="remark" property="remark" jdbcType="LONGVARCHAR"/>
<result column="is_device" property="isDevice" jdbcType="VARCHAR"/>
<result column="aliyun_corp_id" property="aliyunCorpId" jdbcType="VARCHAR"/>
<result column="vds_corp_id" property="vdsCorpId" jdbcType="VARCHAR"/>
<result column="syn_ding_dept_id" property="synDingDeptId" jdbcType="VARCHAR"/>
<result column="region_path" property="regionPath" jdbcType="VARCHAR"/>
<result column="has_camera" property="hasCamera" jdbcType="TINYINT"/>
<result column="region_id" property="regionId" jdbcType="VARCHAR"/>
<result column="store_status" property="storeStatus" jdbcType="VARCHAR"/>
<result column="open_date" property="openDate" jdbcType="DATE"/>
<result column="monthly_rent" property="monthlyRent"/>
<result column="monthly_personnel_salary" property="monthlyPersonnelSalary"/>
<result column="monthly_other_expenses" property="monthlyOtherExpenses"/>
<result column="unified_management" property="unifiedManagement" jdbcType="TINYINT"/>
<result column="join_model" property="joinModel" jdbcType="TINYINT"/>
<result column="join_brand" property="joinBrand" jdbcType="TINYINT"/>
<result column="store_type" property="storeType" jdbcType="TINYINT"/>
<result column="mini_program_order_store_name" property="miniProgramOrderStoreName"/>
<result column="is_iot" property="isIot" jdbcType="TINYINT"/>
<result column="addressee_name" property="addresseeName" jdbcType="VARCHAR"/>
<result column="addressee_mobile" property="addresseeMobile" jdbcType="VARCHAR"/>
<result column="addressee_area" property="addresseeArea" jdbcType="VARCHAR"/>
<result column="addressee_address" property="addresseeAddress" jdbcType="VARCHAR"/>
</resultMap>
<select id="getByStoreId" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where store_id = #{storeId}
</select>
<select id="getEffectiveStoreByStoreIds" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where is_delete = 'effective'
<if test="storeIds != null">
<foreach collection="storeIds" item="item" separator="," open="and store_id in (" close=")">
#{item}
</foreach>
</if>
</select>
<select id="listStoreByRegionId" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where is_delete = 'effective'
<if test="regionId != null and regionId!= '' ">
and region_path like concat('%/', #{regionId}, '/%')
</if>
</select>
<select id="getStoreNumByStoreIds" resultType="java.lang.String">
select store_num
from store_${enterpriseId}
where is_delete = 'effective'
<if test="storeIds != null">
<foreach collection="storeIds" item="item" separator="," open="and store_id in (" close=")">
#{item}
</foreach>
</if>
</select>
<select id="getByStoreNum" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where store_num = #{storeNum} and is_delete = 'effective'
</select>
<select id="listByMobile" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
<where>
and is_delete = 'effective'
<if test="mobile!=null and mobile !=''">
and `extend_field` like concat('%', #{mobile}, '%')
</if>
</where>
</select>
<select id="getSubStoreByRegionIdsAndMobile" resultType="com.cool.store.response.MiniShopsResponse">
select store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress
from store_${enterpriseId}
where is_delete = 'effective'
<if test="storeName!=null and storeName!=''">
and store_name like concat('%', #{storeName}, '%')
</if>
<if test="storeNum!=null and storeNum!=''">
and store_num = #{storeNum}
</if>
and (
<if test="regionIdList != null and regionIdList.size >0 ">
<foreach collection="regionIdList" item="regionId" separator=" or " open=" (" close=" )">
region_path like concat('%/', #{regionId}, '/%')
</foreach>
</if>
<if test="mobile!=null and mobile !=''">
<choose>
<when test="regionIdList != null and regionIdList.size >0 ">
or `extend_field` like concat('%', #{mobile}, '%')
</when>
<otherwise>
`extend_field` like concat('%', #{mobile}, '%')
</otherwise>
</choose>
</if>
)
</select>
<select id="list" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where is_delete = 'effective'
<if test="isIot != null">
AND is_iot = #{isIot}
</if>
order by id asc
</select>
<select id="getStoreAreaList" resultType="com.cool.store.dto.store.StoreAreaDTO">
select
a.store_num as storeCode,
a.store_name as storeName,
a.store_id as storeId,
a.region_path as regionPath,
a.region_id as regionId,
a.region_id as areaId,
a.store_status as storeStatus
FROM store_${enterpriseId} a
<where>
a.is_delete='effective'
<if test="storeIds!=null and storeIds.size>0">
<foreach collection="storeIds" item="storeId" index="index" separator="," open="and a.store_id in("
close=")">
#{storeId}
</foreach>
</if>
</where>
</select>
<select id="getStoreNumByStoreCodes" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where is_delete = 'effective'
<if test="storeCodeIds != null">
<foreach collection="storeCodeIds" item="item" separator="," open="and store_num in (" close=")">
#{item}
</foreach>
</if>
</select>
<select id="listStoreByRegionPathList" resultType="com.cool.store.dto.store.StoreAreaDTO">
select
store_name as storeName,
store_id as storeId,
region_path as regionPath,
region_id as regionId,
region_id as areaId
from store_${enterpriseId}
where is_delete = 'effective'
<if test="regionPathList != null and regionPathList.size >0 ">
<foreach collection="regionPathList" item="regionPath" separator=" or " open="and (" close=" )">
region_path like concat(#{regionPath}, '%')
</foreach>
</if>
</select>
</mapper>