刘帅
2026-09-30 4e8cadb13ebd6f01b8cf6d5cc89757cf8e960792
cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
@@ -1,9 +1,53 @@
<?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.dsh.course.mapper.StoreMapper">
    <insert id="addConfigOne">
        insert into t_store_other_config(id,
                                        url,
                                        `name`,
                                        page,
                                        `type`,
                                        turnId,
                                        sort,
                                        state,pageId,typeId
                                        ) value (null ,#{url},#{name},#{s},#{s1},#{turnId},#{sort},1,#{page},#{type})
    </insert>
    <update id="updateBasicConfig">
        update t_img_config
        set content = #{p1}
        where `position` =#{position}
    </update>
    <select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
        select t1.*,t2.name userName,t2.phone userPhone from t_store t1 left join sys_user t2 on t1.storeStaffId = t2.id
    <update id="updateBasicBenefits">
        update t_img_config
        set content = #{p1}
        where `position` =#{position}
    </update>
    <update id="inset">
        update t_js
        set jieshao = #{jieshao} ,vedio = #{vedio}
        where id = #{id}
    </update>
    <delete id="delete1">
        delete from t_store_other_config where id =#{id}
    </delete>
    <!--
        phone 明确映射为 t_store.phone。不要同时返回两个名为 phone 的列,
        否则 MyBatis 自动映射可能按 JDBC 列顺序覆盖该字段。
    -->
    <resultMap id="storeListResultMap" type="com.dsh.guns.modular.system.model.TStoreListVo" autoMapping="true">
        <result property="phone" column="storePhone"/>
    </resultMap>
    <select id="listAll" resultMap="storeListResultMap">
        select t1.*,
               t1.phone as storePhone,
               t3.name as yysName
        from t_store t1
        left  join t_operator t3 on t1.operatorId = t3.id
        where 1=1
        <if test="provinceCode !=null and provinceCode !=''">
            and t1.provinceCode = #{provinceCode}
@@ -12,18 +56,22 @@
            and t1.cityCode = #{cityCode}
        </if>
        <if test="name !=null and name !=''">
            and t2.name like concat("%",#{name},"%")
            and t1.managerName like concat("%",#{name},"%")
        </if>
        <if test="phone !=null and phone !=''">
            and t2.phone like concat("%",#{phone},"%")
            and t1.phone like concat("%",#{phone},"%")
        </if>
        <if test="shopName !=null and shopName !=''">
            and t1.name like concat("%",#{shopName},"%")
        </if>
        <if test="operatorId !=null and operatorId !=''">
            and t1.operatorId = #{operatorId}
        </if>
        order by t1.id desc
    </select>
    <select id="queryProvince" resultType="map">
        select * from (
        select provinceCode as code, province as name from t_store where state = 1
        select provinceCode as code, MIN(province) as name from t_store where state = 1
         <if test="null != cityCode and '' != cityCode">
             and cityCode = #{cityCode}
         </if>
@@ -34,15 +82,250 @@
    <select id="queryCity" resultType="map">
        select * from (
        select cityCode as code, city as name from t_store where state = 1 and provinceCode = #{provinceCode}
        select cityCode as code, MIN(city) as name from t_store where state = 1 and provinceCode = #{provinceCode}
        <if test="null != cityCode and '' != cityCode">
            and cityCode = #{cityCode}
        </if>
        group by cityCode
        ) as aa order by aa.code
    </select>
    <select id="queryListOfpage" resultType="java.util.Map">
        SELECT id, cityManagerId, province, city, `name`
        from t_store
    <select id="queryCity2" resultType="map">
        select * from (
        select cityCode as code, MIN(city) as name
        from t_store where state = 1 and provinceCode = #{provinceCode}
        <if test="null != cityCode and '' != cityCode">
            and cityCode = #{cityCode}
        </if>
        <if test="null != type">
        and `type` = #{type}
        </if>
        <if test="null != operatorId">
        and operatorId = #{operatorId}
        </if>
        group by cityCode
        ) as aa order by aa.code
    </select>
</mapper>
    <select id="queryCity1" resultType="map">
        select * from (
        select cityCode as code, MIN(city) as name from t_store where state = 1
        group by cityCode
        ) as aa order by aa.code
    </select>
    <select id="queryListOfpage" resultType="java.util.Map">
        SELECT `id`, `operatorId`, `province`, `city`, `name`,ids
        from t_store
        where state=1
        <if test="provinceCode != null and provinceCode!=''">
            and provinceCode = #{provinceCode}
        </if>
        <if test="cityCode != null and cityCode!=''">
            and cityCode = #{cityCode}
        </if>
        <if test="operatorId != null and operatorId!=''">
            and operatorId = #{operatorId}
        </if>
        <if test="storeName != null and storeName != ''">
            and `name` like CONCAT('%',#{storeName},'%')
        </if>
        order by id desc
    </select>
    <select id="listOne" resultType="java.util.Map">
        select id,name,sort,state from t_store_other where storeId=#{id} order by id desc
    </select>
    <select id="typeChange" resultType="java.util.Map">
        select t1.id,t1.name from t_turn t1 left join  t_turn t2 on t1.pid = t2.id where t2.name  =#{name} order by t1.id desc
    </select>
    <select id="typeChangeOne" resultType="java.util.Map">
        select id,name from t_turn  where pid  =#{id} order by id desc
    </select>
    <select id="getConfig" resultType="java.lang.String">
        select name from t_turn where id =#{page}
    </select>
    <select id="listTwo" resultType="java.util.Map">
        select id,url,name ,  page,sort from t_store_other_config order by id desc
    </select>
    <select id="getPage" resultType="com.dsh.guns.modular.system.model.TTurn">
        select * from t_turn
        <where>
            <if test="ids != null and ids.size()>0">
                AND t_turn.pid IN
                <foreach collection="ids" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        order by t_turn.id desc
    </select>
    <select id="pageList" resultType="com.dsh.guns.modular.system.model.TTurn">
        select * from t_turn where pid = 0 order by id desc
    </select>
    <select id="get" resultType="com.dsh.course.dto.JsDto">
        select * from t_js where  id = #{id}
    </select>
    <select id="getConfig1" resultType="com.dsh.guns.modular.system.model.TImgConfig">
        select * from t_img_config order by id desc
    </select>
    <select id="getSelect" resultType="com.dsh.guns.modular.system.model.dto.SelectDto">
        SELECT op.id , CONCAT(us.name,'-',us.`phone`) as value
        FROM t_operator op
            LEFT JOIN sys_user us on op.userId = us.id
        order by op.id desc
    </select>
    <select id="listAllStore" resultMap="storeListResultMap">
        select t1.*,
               t1.phone as storePhone,
               t3.name as yysName
        from t_store t1
        left join t_operator t3 on t1.operatorId = t3.id
        where t1.id =#{id}
        <if test="provinceCode !=null and provinceCode !=''">
            and t1.provinceCode = #{provinceCode}
        </if>
        <if test="cityCode !=null and cityCode !=''">
            and t1.cityCode = #{cityCode}
        </if>
        <if test="name !=null and name !=''">
            and t1.managerName like concat("%",#{name},"%")
        </if>
        <if test="phone !=null and phone !=''">
            and t1.phone like concat("%",#{phone},"%")
        </if>
        <if test="shopName !=null and shopName !=''">
            and t1.name like concat("%",#{shopName},"%")
        </if>
        order by t1.id desc
    </select>
    <select id="listAllStoresByIds" resultMap="storeListResultMap">
        select t1.*,
               t1.phone as storePhone,
               t3.name as yysName
        from t_store t1
        left join t_operator t3 on t1.operatorId = t3.id
        where t1.id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        <if test="provinceCode !=null and provinceCode !=''">
            and t1.provinceCode = #{provinceCode}
        </if>
        <if test="cityCode !=null and cityCode !=''">
            and t1.cityCode = #{cityCode}
        </if>
        <if test="name !=null and name !=''">
            and t1.managerName like concat("%",#{name},"%")
        </if>
        <if test="phone !=null and phone !=''">
            and t1.phone like concat("%",#{phone},"%")
        </if>
        <if test="shopName !=null and shopName !=''">
            and t1.name like concat("%",#{shopName},"%")
        </if>
        order by t1.id desc
    </select>
    <select id="querySiteListOfpage" resultType="java.util.Map">
        SELECT t1.id, t2.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName
        ,t2.type as `type`
        from t_site t1
        left join t_store t2 on t1.storeId =t2.id
        where t1.state=1 and t2.state=1 and t1.isCanBeBooked = 0 and t1.reservation=0
        <if test="provinceCode != null and provinceCode!=''">
            and t1.provinceCode = #{provinceCode}
        </if>
        <if test="cityCode != null and cityCode!=''">
            and t1.cityCode = #{cityCode}
        </if>
        <if test="operatorId != null and operatorId!=''">
            and t1.operatorId = #{operatorId}
        </if>
        <if test="storeName != null and storeName != ''">
            and t2.name like CONCAT('%',#{storeName},'%')
        </if>
        <if test="storeId != null">
            and t1.storeId = #{storeId}
        </if>
        order by t1.id desc
    </select>
    <select id="querySiteListOfpageOperator" resultType="java.util.Map">
        SELECT t1.id, t2.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName
        ,t2.type as `type`
        from t_site t1
        left join t_store t2 on t1.storeId =t2.id
        where t1.state=1 and t2.state=1
        <if test="provinceCode != null and provinceCode!=''">
            and t1.provinceCode = #{provinceCode}
        </if>
        <if test="cityCode != null and cityCode!=''">
            and t1.cityCode = #{cityCode}
        </if>
        <if test="storeName != null and storeName != ''">
            and t2.name like CONCAT('%',#{storeName},'%')
        </if>
        <if test="storeIds != null and storeIds.size()>0">
            AND t1.storeId IN
            <foreach collection="storeIds" separator="," item="id" open="(" close=")">
                #{id}
            </foreach>
        </if>
        order by t1.id desc
    </select>
    <select id="listStoreAll" resultType="map">
        select
        a.id,
        CONCAT(a.province, a.city) as province,
        b.name as operator,
        a.name,
        c.gate
        from t_store a
        left join t_operator b on (a.operatorId = b.id)
        left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId)
        where a.state = 1
        <if test="null != name and '' != name">
            and a.name like CONCAT('%', #{name}, '%')
        </if>
        <if test="null != operator">
            and a.operatorId = #{operator}
        </if>
        <if test="null != provinceCode and '' != provinceCode">
            and a.provinceCode = #{provinceCode}
        </if>
        <if test="null != cityCode and '' != cityCode">
            and a.cityCode = #{cityCode}
        </if>
        order by a.id desc
    </select>
    <select id="listStoreAllByIds" resultType="map">
        select
            a.id,
            CONCAT(a.province, a.city) as province,
            b.name as operator,
            a.name,
            c.gate
        from t_store a
        left join t_operator b on (a.operatorId = b.id)
        left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId)
        where a.id in
        <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
        order by a.id desc
    </select>
</mapper>