fix 开店管理根据意向区域查询

This commit is contained in:
shuo.wang
2025-01-14 18:48:40 +08:00
parent a5747908e2
commit a98828529a
8 changed files with 66 additions and 31 deletions

View File

@@ -174,4 +174,11 @@ public class HyOpenAreaInfoDAO {
List<HyOpenAreaInfoDO> openAreaInfoList = selectByIds(wantShopAreaIds);
return openAreaInfoList.stream().collect(Collectors.toMap(k->k.getId(), v->v, (k1, k2)->k1));
}
public List<Long> getChildrenListByParentIds(List<Long> parentIds) {
if (CollectionUtils.isEmpty(parentIds)) {
return Lists.newArrayList();
}
return hyOpenAreaInfoMapper.getChildrenListByParentIds(parentIds);
}
}

View File

@@ -61,6 +61,8 @@ public interface HyOpenAreaInfoMapper {
*/
List<HyOpenAreaInfoDO> getChildrenList(@Param("parentId") Long parentId);
List<Long> getChildrenListByParentIds(@Param("parentIds") List<Long> parentIds);
Integer getChildrenCount(@Param("type") String type ,
@Param("parentId") Long parentId);

View File

@@ -2,28 +2,29 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.HyOpenAreaInfoMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyOpenAreaInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="area_name" jdbcType="VARCHAR" property="areaName" />
<result column="area_path" jdbcType="VARCHAR" property="areaPath" />
<result column="background_banner" jdbcType="VARCHAR" property="backgroundBanner" />
<result column="detail_banner" jdbcType="VARCHAR" property="detailBanner" />
<result column="area_status" jdbcType="VARCHAR" property="areaStatus" />
<result column="deleted" jdbcType="TINYINT" property="deleted" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
<result column="area_name" jdbcType="VARCHAR" property="areaName"/>
<result column="area_path" jdbcType="VARCHAR" property="areaPath"/>
<result column="background_banner" jdbcType="VARCHAR" property="backgroundBanner"/>
<result column="detail_banner" jdbcType="VARCHAR" property="detailBanner"/>
<result column="area_status" jdbcType="VARCHAR" property="areaStatus"/>
<result column="deleted" jdbcType="TINYINT" property="deleted"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
</resultMap>
<sql id="Base_Column_List">
id, parent_id, area_name, area_path, background_banner, detail_banner, area_status,
deleted, create_time, update_time, update_user_id
</sql>
<select id="selectById" resultMap="BaseResultMap">
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from xfsg_open_area_info where id = #{id}
</select>
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOpenAreaInfoDO" keyProperty="record.id" useGeneratedKeys="true">
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOpenAreaInfoDO" keyProperty="record.id"
useGeneratedKeys="true">
insert into xfsg_open_area_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.id != null">
@@ -137,7 +138,6 @@
</update>
<update id="batchUpdateById">
update xfsg_open_area_info
<set>
@@ -164,7 +164,6 @@
</update>
<update id="batchUpdateByParentId">
update xfsg_open_area_info
<set>
@@ -207,7 +206,7 @@
xfsg_open_area_info
<where>
<if test="keyword!=null and keyword!=''">
and area_path like concat('%',#{keyword},'%')
and area_path like concat('%',#{keyword},'%')
</if>
<if test="applyFlag!=null and applyFlag==true">
and (area_status = 'open' or area_status = 'keyOpen')
@@ -239,7 +238,6 @@
</select>
<select id="getChildrenList" resultMap="BaseResultMap">
select * from
xfsg_open_area_info
@@ -280,7 +278,9 @@
</select>
<select id="getAllOpenArea" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from xfsg_open_area_info
select
<include refid="Base_Column_List"/>
from xfsg_open_area_info
</select>
<select id="filterLeafNode" resultType="long">
@@ -289,7 +289,8 @@
from
xfsg_open_area_info
where
deleted = '0' and province_city_flag = '0' and id in <foreach collection="openAreaIds" item="openAreaId" separator="," open="(" close=")">#{openAreaId}</foreach>
deleted = '0' and province_city_flag = '0' and id in
<foreach collection="openAreaIds" item="openAreaId" separator="," open="(" close=")">#{openAreaId}</foreach>
</select>
<select id="getSonArea" resultType="com.cool.store.entity.HyOpenAreaInfoDO">
SELECT
@@ -297,15 +298,15 @@
FROM xfsg_open_area_info
WHERE parent_id = #{id}
</select>
<select id="getProvinceAllCode" resultMap="BaseResultMap">
SELECT b.* FROM `xfsg_open_area_info` a inner join xfsg_open_area_info b on a.`id`=b.`parent_id`
WHERE a.parent_id=#{id} ORDER BY b.id desc
<select id="getProvinceAllCode" resultMap="BaseResultMap">
SELECT b.* FROM `xfsg_open_area_info` a inner join xfsg_open_area_info b on a.`id`=b.`parent_id`
WHERE a.parent_id=#{id} ORDER BY b.id desc
</select>
<select id="selectByAreaPath" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"></include>
FROM `xfsg_open_area_info`
WHERE area_path= concat('/',#{areaPath},'/') and deleted=0 and province_city_flag=0
WHERE area_path= concat('/',#{areaPath},'/') and deleted=0 and province_city_flag=0
</select>
<select id="selectAllCity" resultMap="BaseResultMap">
@@ -314,7 +315,15 @@
FROM `xfsg_open_area_info`
WHERE deleted=0 and province_city_flag = 1 and parent_id is not null
</select>
<select id="getChildrenListByParentIds" resultType="java.lang.Long">
select id from xfsg_open_area_info where 1=1
<if test="parentIds!=null and parentIds.size>0">
parent_id in
<foreach collection="parentIds" item="parentId" separator="," open="(" close=")">
#{parentId}
</foreach>
</if>
</select>
</mapper>

View File

@@ -318,6 +318,13 @@
<if test="request.shopStatus!=null">
and a.shop_status = #{request.shopStatus}
</if>
<if test="request.wantShopAreaAllIds != null and request.wantShopAreaAllIds.size() > 0">
and a.want_shop_area_id in
<foreach collection="request.wantShopAreaAllIds" item="wantShopAreaId" index="index" open="(" separator=","
close=")">
#{wantShopAreaId}
</foreach>
</if>
order by a.update_time desc
</select>
<select id="getShopListByRegion" resultType="com.cool.store.entity.ShopInfoDO">