C端城市相关接口
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.dto.partner.ApplyReservationProvinceDTO;
|
||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||
import com.cool.store.entity.HyPartnerBaseInfoDO;
|
||||
import com.cool.store.mapper.HyOpenAreaInfoMapper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/6 14:32
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Repository
|
||||
public class HyOpenAreaInfoDAO {
|
||||
|
||||
@Resource
|
||||
HyOpenAreaInfoMapper hyOpenAreaInfoMapper;
|
||||
|
||||
public PageInfo<HyOpenAreaInfoDO> queryKeyOpenArea(){
|
||||
return hyOpenAreaInfoMapper.queryKeyOpenArea();
|
||||
}
|
||||
|
||||
public List<HyOpenAreaInfoDO> queryByKeyword(String keyword){
|
||||
if (StringUtils.isEmpty(keyword)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyOpenAreaInfoMapper.queryByKeyword(keyword);
|
||||
}
|
||||
|
||||
public List<HyOpenAreaInfoDO> queryFirstLevel(){
|
||||
return hyOpenAreaInfoMapper.queryFirstLevel();
|
||||
}
|
||||
|
||||
public List<HyOpenAreaInfoDO> queryByIdsExcludeFirstLevel(List<Long> ids){
|
||||
if (CollectionUtils.isEmpty(ids)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyOpenAreaInfoMapper.queryByIdsExcludeFirstLevel(ids);
|
||||
}
|
||||
|
||||
public List<ApplyReservationProvinceDTO> getApplyReservationProvinceCount(){
|
||||
return hyOpenAreaInfoMapper.getApplyReservationProvinceCount();
|
||||
}
|
||||
|
||||
public List<HyOpenAreaInfoDO> getChildrenList(String type ,Long parentId){
|
||||
if (parentId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyOpenAreaInfoMapper.getChildrenList(type,parentId);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.partner.ApplyReservationProvinceDTO;
|
||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||
import com.cool.store.entity.HyPartnerBaseInfoDO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-05-29 03:51
|
||||
@@ -22,4 +27,46 @@ public interface HyOpenAreaInfoMapper {
|
||||
* dateTime:2023-05-29 03:51
|
||||
*/
|
||||
int updateByPrimaryKeySelective(@Param("record") HyOpenAreaInfoDO record);
|
||||
|
||||
/**
|
||||
* 查询重点城市
|
||||
* @return
|
||||
*/
|
||||
PageInfo<HyOpenAreaInfoDO> queryKeyOpenArea();
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有
|
||||
* @return
|
||||
*/
|
||||
List<HyOpenAreaInfoDO> queryByKeyword(@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 查询所有一级城市 (所有省份+直辖市)
|
||||
* @return
|
||||
*/
|
||||
List<HyOpenAreaInfoDO> queryFirstLevel();
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有一级城市 (所有省份+直辖市)
|
||||
* @return
|
||||
*/
|
||||
List<HyOpenAreaInfoDO> queryByIdsExcludeFirstLevel(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询省份可申请可预约数量
|
||||
* @return
|
||||
*/
|
||||
List<ApplyReservationProvinceDTO> getApplyReservationProvinceCount();
|
||||
|
||||
/**
|
||||
* 查询子列表
|
||||
* @return
|
||||
*/
|
||||
List<HyOpenAreaInfoDO> getChildrenList(@Param("type") String type , @Param("parentId") Long parentId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
id, parent_id, area_name, area_path, background_banner, detail_banner, area_status,
|
||||
deleted, create_time, update_time, update_user_id
|
||||
</sql>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOpenAreaInfoDO" keyProperty="record.id" useGeneratedKeys="true">
|
||||
insert into hy_open_area_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="record.parentId != null">
|
||||
@@ -121,4 +121,62 @@
|
||||
</set>
|
||||
where id = #{record.id}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="queryKeyOpenArea" resultMap="BaseResultMap">
|
||||
select * from
|
||||
hy_open_area_info
|
||||
where area_status = 'keyOpen'
|
||||
</select>
|
||||
|
||||
<select id="queryByKeyword" resultMap="BaseResultMap">
|
||||
select * from
|
||||
hy_open_area_info
|
||||
where area_path like concat('%',#{keyword},'%')
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryFirstLevel" resultMap="BaseResultMap">
|
||||
select * from
|
||||
hy_open_area_info where parent_id is null
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryByIdsExcludeFirstLevel" resultMap="BaseResultMap">
|
||||
select * from
|
||||
hy_open_area_info where parent_id is not null
|
||||
<if test="ids !=null and ids.size>0">
|
||||
<foreach collection="ids" item="id" open="and id in (" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getApplyReservationProvinceCount" resultType="com.cool.store.dto.partner.ApplyReservationProvinceDTO">
|
||||
SELECT
|
||||
substring(SUBSTRING_INDEX(area_path,'/',2),2) as areaName,
|
||||
sum(if((area_status='open' or area_status = 'keyOpen') ,1,0)) as applyCount,
|
||||
sum(if((area_status='notOpen' or area_status = 'saturated') ,1,0)) as reservationCount
|
||||
FROM `hy_open_area_info` where parent_id is not null
|
||||
group by substring(SUBSTRING_INDEX(area_path,'/',2),2)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getChildrenList" resultMap="BaseResultMap">
|
||||
select * from
|
||||
hy_open_area_info
|
||||
<where>
|
||||
<if test="parentId!=null">
|
||||
and parent_id = #{parentId}
|
||||
</if>
|
||||
<if test="type!=null and type == 'apply'">
|
||||
and (area_status = 'open' or area_status = 'keyOpen')
|
||||
</if>
|
||||
<if test="type!=null and type == 'reservation'">
|
||||
and (area_status='notOpen' or area_status = 'saturated')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user