招商 基础

This commit is contained in:
苏竹红
2024-03-07 11:33:54 +08:00
parent c0789d6932
commit 32942b5da9
75 changed files with 5001 additions and 179 deletions

View File

@@ -0,0 +1,50 @@
package com.cool.store.dao;
import cn.hutool.core.bean.BeanUtil;
import com.cool.store.dto.content.ContentAddDto;
import com.cool.store.dto.content.ContentQueryListDto;
import com.cool.store.dto.content.ContentUpdateDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.mapper.HyContentInfoMapper;
import com.cool.store.vo.HyContentInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author su'zh
*/
@Repository
@Deprecated
public class ContentDAO {
@Autowired
private HyContentInfoMapper contentInfoMapper;
public String addContentInfo(ContentAddDto dto) {
HyContentInfoDO hyContentInfoDO = new HyContentInfoDO();
BeanUtil.copyProperties(dto, hyContentInfoDO);
hyContentInfoDO.setUpdateUserId(dto.getCreateUserId());
return Integer.toString(contentInfoMapper.insertSelective(hyContentInfoDO));
}
public void deleteContent(String contentId) {
contentInfoMapper.deleteSelective(contentId);
}
public void updateContent(ContentUpdateDto dto) {
HyContentInfoDO hyContentInfoDO = new HyContentInfoDO();
BeanUtil.copyProperties(dto, hyContentInfoDO);
hyContentInfoDO.setId(Long.parseLong(dto.getContentId()));
contentInfoMapper.updateByPrimaryKeySelective(hyContentInfoDO);
}
public List<HyContentInfoVO> queryContentList(ContentQueryListDto dto) {
return contentInfoMapper.queryContentList(dto);
}
public HyContentInfoDO queryContentInfo(String contentId) {
return contentInfoMapper.queryContentInfo(contentId);
}
}

View File

@@ -0,0 +1,159 @@
package com.cool.store.dao;
import cn.hutool.core.convert.Convert;
import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.mapper.HyOpenAreaInfoMapper;
import com.cool.store.utils.StringUtil;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author suzhuhong
* @Date 2023/6/6 14:32
* @Version 1.0
*/
@Repository
public class HyOpenAreaInfoDAO {
@Resource
HyOpenAreaInfoMapper hyOpenAreaInfoMapper;
public List<HyOpenAreaInfoDO> queryKeyOpenArea(){
return hyOpenAreaInfoMapper.queryKeyOpenArea();
}
public List<HyOpenAreaInfoDO> queryByKeyword(String keyword,Boolean applyFlag,String areaStatus,Boolean filterData){
return hyOpenAreaInfoMapper.queryByKeyword(keyword,applyFlag,areaStatus,filterData);
}
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<HyOpenAreaInfoDO> getChildrenList(String type ,Long parentId){
if (parentId==null){
return new ArrayList<>();
}
return hyOpenAreaInfoMapper.getChildrenList(type,parentId);
}
public Integer getChildrenCount(String type ,Long parentId){
if (parentId==null){
return 0;
}
return hyOpenAreaInfoMapper.getChildrenCount(type,parentId);
}
public int batchUpdateById(String backgroundBanner,String detailBanner,String areaStatus,String updateUserId,List<Long> ids){
if (StringUtils.isEmpty(areaStatus)){
return 0;
}
return hyOpenAreaInfoMapper.batchUpdateById(backgroundBanner,detailBanner,areaStatus,updateUserId,ids);
}
public int batchUpdateByParentId(String backgroundBanner,String detailBanner,String areaStatus,String updateUserId,List<Long> ids){
if (StringUtils.isEmpty(areaStatus)){
return 0;
}
return hyOpenAreaInfoMapper.batchUpdateByParentId(backgroundBanner,detailBanner,areaStatus,updateUserId,ids);
}
public List<HyOpenAreaInfoDO> selectByIds(List<Long> ids){
if (CollectionUtils.isEmpty(ids)){
return Lists.newArrayList();
}
return hyOpenAreaInfoMapper.selectByIds(ids);
}
public Map<Long, String> getNameMapByIds(List<Long> ids){
if (CollectionUtils.isEmpty(ids)){
return Maps.newHashMap();
}
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOS = hyOpenAreaInfoMapper.selectByIds(ids);
return ListUtils.emptyIfNull(hyOpenAreaInfoDOS).stream().collect(Collectors.toMap(k->k.getId(), v->v.getAreaName(), (k1, k2)->k1));
}
public Map<String, String> selectNameMapByIds(List<Long> ids){
if (CollectionUtils.isEmpty(ids)){
return Maps.newHashMap();
}
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOS = hyOpenAreaInfoMapper.selectByIds(ids);
return ListUtils.emptyIfNull(hyOpenAreaInfoDOS).stream().collect(Collectors.toMap(k->String.valueOf(k.getId()), v->v.getAreaPath().replace("/"," ")));
}
public HyOpenAreaInfoDO selectById(Long id){
if (id==null){
return null;
}
return hyOpenAreaInfoMapper.selectById(id);
}
public List<HyOpenAreaInfoDO> getAllOpenArea(){
return hyOpenAreaInfoMapper.getAllOpenArea();
}
public List<HyOpenAreaInfoDO> selectAllCity(){
return hyOpenAreaInfoMapper.selectAllCity();
}
/**
* 过滤叶子节点
* @param openAreaIds
* @return 叶子节点id
*/
public List<Long> filterLeafNode(List<Long> openAreaIds){
if(CollectionUtils.isEmpty(openAreaIds)){
return Lists.newArrayList();
}
return hyOpenAreaInfoMapper.filterLeafNode(openAreaIds);
}
public List<HyOpenAreaInfoDO> getAllAreaCode(String id) {
if (StringUtils.isEmpty(id)){
return new ArrayList<>();
}
//获取省下所有数据
List<HyOpenAreaInfoDO> provinceCodeList= hyOpenAreaInfoMapper.getProvinceAllCode(id);
if(CollectionUtils.isEmpty(provinceCodeList)){
//获取市区下所有数据
List<HyOpenAreaInfoDO> cityCodeList= hyOpenAreaInfoMapper.getSonArea(id);
if(CollectionUtils.isEmpty(cityCodeList)){
return new ArrayList<HyOpenAreaInfoDO>(){{ add(hyOpenAreaInfoMapper.selectById(Convert.toLong(id)));}};
}else {
return cityCodeList;
}
}else {
return provinceCodeList;
}
}
public HyOpenAreaInfoDO selectByAreaPath(String areaPath) {
if (StringUtil.isEmpty(areaPath)) {
return null;
}
return hyOpenAreaInfoMapper.selectByAreaPath(areaPath);
}
}

View File

@@ -0,0 +1,62 @@
package com.cool.store.mapper;
import com.cool.store.dto.content.ContentQueryListDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.vo.HyContentInfoVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-05-29 03:50
*/
public interface HyContentInfoMapper {
/**
*
* 默认插入方法,只会给有值的字段赋值
* 会对传进来的字段做判空处理如果字段为空则使用数据库默认字段或者null
* dateTime:2023-05-29 03:50
*/
int insertSelective(@Param("record") HyContentInfoDO record);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-05-29 03:50
*/
int updateByPrimaryKeySelective(@Param("record") HyContentInfoDO record);
/**
* 删除方法
* @param contentId
*/
void deleteSelective(@Param("contentId") String contentId);
/**
* 分页查询动态列表
* 根据传入参数匹配
*/
List<HyContentInfoVO> queryContentList(ContentQueryListDto dto);
/**
* C 端使用的动态查询
*/
List<HyContentInfoVO> queryContentListForC(ContentQueryListDto dto);
/**
* 根据contentId查询动态详情
*/
HyContentInfoDO queryContentInfo(@Param("contentId") String contentId);
/**
* 标题是否重复
*/
Boolean whetherTitleDuplicated(@Param("contentTitle") String contentTitle);
/**
* 查询动态标题
*/
List<String> queryTitles();
}

View File

@@ -0,0 +1,119 @@
package com.cool.store.mapper;
import com.cool.store.entity.HyOpenAreaInfoDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-05-29 03:51
*/
public interface HyOpenAreaInfoMapper {
/**
*
* 默认插入方法,只会给有值的字段赋值
* 会对传进来的字段做判空处理如果字段为空则使用数据库默认字段或者null
* dateTime:2023-05-29 03:51
*/
int insertSelective(@Param("record") HyOpenAreaInfoDO record);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-05-29 03:51
*/
int updateByPrimaryKeySelective(@Param("record") HyOpenAreaInfoDO record);
/**
* 查询重点城市
* @return
*/
List<HyOpenAreaInfoDO> queryKeyOpenArea();
/**
* 查询所有
* @return
*/
List<HyOpenAreaInfoDO> queryByKeyword(@Param("keyword") String keyword,
@Param("applyFlag") Boolean applyFlag,
@Param("areaStatus") String areaStatus,
@Param("filterData") Boolean filterData);
/**
* 查询所有一级城市 (所有省份+直辖市)
* @return
*/
List<HyOpenAreaInfoDO> queryFirstLevel();
/**
* 查询所有一级城市 (所有省份+直辖市)
* @return
*/
List<HyOpenAreaInfoDO> queryByIdsExcludeFirstLevel(@Param("ids") List<Long> ids);
/**
* 查询子列表
* @return
*/
List<HyOpenAreaInfoDO> getChildrenList(@Param("type") String type ,
@Param("parentId") Long parentId);
Integer getChildrenCount(@Param("type") String type ,
@Param("parentId") Long parentId);
/**
* 更新城市昨天
* @param backgroundBanner
* @param detailBanner
* @param areaStatus
* @param updateUserId
* @param ids
* @return
*/
int batchUpdateById(@Param("backgroundBanner") String backgroundBanner,
@Param("detailBanner") String detailBanner,
@Param("areaStatus") String areaStatus,
@Param("updateUserId") String updateUserId,
@Param("ids") List<Long> ids);
int batchUpdateByParentId(@Param("backgroundBanner") String backgroundBanner,
@Param("detailBanner") String detailBanner,
@Param("areaStatus") String areaStatus,
@Param("updateUserId") String updateUserId,
@Param("parentIdList") List<Long> parentIdList);
/**
* 根据idList查询数据
* @param idList
* @return
*/
List<HyOpenAreaInfoDO> selectByIds(@Param("idList") List<Long> idList);
HyOpenAreaInfoDO selectById(@Param("id") Long id);
/**
* 获取所有的区域
* @return
*/
List<HyOpenAreaInfoDO> getAllOpenArea();
/**
* 过滤叶子节点
* @param openAreaIds
* @return
*/
List<Long> filterLeafNode(@Param("openAreaIds") List<Long> openAreaIds);
List<HyOpenAreaInfoDO> getSonArea(@Param("id") String id);
List<HyOpenAreaInfoDO> getProvinceAllCode(@Param("id") String id);
HyOpenAreaInfoDO selectByAreaPath(@Param("areaPath") String areaPath);
List<HyOpenAreaInfoDO> selectAllCity();
}

View File

@@ -0,0 +1,34 @@
package com.cool.store.mapper;
import com.cool.store.entity.HyPartnerLabelGroupDO;
import com.cool.store.vo.LabelGroupListVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Fun Li 2023/8/10 13:25
* @version 1.0
*/
@Mapper
public interface HyPartnerLabelGroupMapper {
int deleteByPrimaryKey(Long id);
int insert(HyPartnerLabelGroupDO record);
int insertSelective(HyPartnerLabelGroupDO record);
HyPartnerLabelGroupDO selectByPrimaryKey(Long id);
List<HyPartnerLabelGroupDO> selectSelective(HyPartnerLabelGroupDO record);
List<LabelGroupListVo> getLabelGroupList(HyPartnerLabelGroupDO record);
List<LabelGroupListVo> getLabelGroupListOrder(HyPartnerLabelGroupDO record);
int updateByPrimaryKeySelective(HyPartnerLabelGroupDO record);
int updateByPrimaryKey(HyPartnerLabelGroupDO record);
}

View File

@@ -0,0 +1,38 @@
package com.cool.store.mapper;
import com.cool.store.dto.label.LabelListDTO;
import com.cool.store.entity.HyPartnerLabelDO;
import com.cool.store.vo.LabelListVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Fun Li
* @date 2023-08-10
*/
public interface HyPartnerLabelMapper {
int deleteByPrimaryKey(Long id);
int insert(HyPartnerLabelDO record);
int insertSelective(HyPartnerLabelDO record);
HyPartnerLabelDO selectByPrimaryKey(Long id);
List<HyPartnerLabelDO> selectSelective(HyPartnerLabelDO labelDO);
int updateByPrimaryKeySelective(HyPartnerLabelDO record);
int updateByPrimaryKey(HyPartnerLabelDO record);
List<LabelListVo> getLabelList(LabelListDTO dto);
/**
* 某个标签组内是否有未删除的标签
* @param labelGroupId 标签组 id
*/
Boolean whetherGroupInUse(@Param("labelGroupId") Long labelGroupId);
List<HyPartnerLabelDO> getLabelListByIds(@Param("labelIds") List<Long> labelIds);
}

View File

@@ -0,0 +1,229 @@
<?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.HyContentInfoMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyContentInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="content_title" jdbcType="VARCHAR" property="contentTitle" />
<result column="subject" jdbcType="VARCHAR" property="subject" />
<result column="content_type" jdbcType="VARCHAR" property="contentType" />
<result column="cover" jdbcType="VARCHAR" property="cover" />
<result column="status" jdbcType="TINYINT" property="status" />
<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="create_user_id" jdbcType="VARCHAR" property="createUserId" />
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.HyContentInfoDO">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</resultMap>
<resultMap id="HyContentInfoVOList" type="com.cool.store.vo.HyContentInfoVO">
<association property="updateUserName" column="update_user_id" select="getUpdateUserName"></association>
<association property="updateUserPhone" column="update_user_id" select="getUpdateUserPhone"></association>
</resultMap>
<sql id="Base_Column_List">
id, content_title, `subject`, content_type, cover, content, `status`, deleted, create_time, update_time,
create_user_id, update_user_id
</sql>
<sql id="Blob_Column_List">
content
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_content_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.contentTitle != null">
content_title,
</if>
<if test="record.subject != null">
subject,
</if>
<if test="record.contentType != null">
content_type,
</if>
<if test="record.cover != null">
cover,
</if>
<if test="record.status != null">
status,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.createUserId != null">
create_user_id,
</if>
<if test="record.updateUserId != null">
update_user_id,
</if>
<if test="record.content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.contentTitle != null">
#{record.contentTitle},
</if>
<if test="record.subject != null">
#{record.subject},
</if>
<if test="record.contentType != null">
#{record.contentType},
</if>
<if test="record.cover != null">
#{record.cover},
</if>
<if test="record.status != null">
#{record.status},
</if>
<if test="record.deleted != null">
#{record.deleted},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.createUserId != null">
#{record.createUserId},
</if>
<if test="record.updateUserId != null">
#{record.updateUserId},
</if>
<if test="record.content != null">
#{record.content},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_content_info
<set>
<if test="record.contentTitle != null and record.contentTitle != ''">
content_title = #{record.contentTitle},
</if>
<if test="record.subject != null">
subject = #{record.subject},
</if>
<if test="record.contentType != null">
content_type = #{record.contentType},
</if>
<if test="record.cover != null and record.cover != ''">
cover = #{record.cover},
</if>
<if test="record.status != null and record.status != null">
status = #{record.status},
</if>
<if test="record.deleted != null and record.deleted != ''">
deleted = #{record.deleted},
</if>
<if test="record.createTime != null and record.createTime != ''">
create_time = #{record.createTime},
</if>
<if test="record.updateTime != null and record.updateTime != ''">
update_time = #{record.updateTime},
</if>
<if test="record.createUserId != null and record.createUserId != ''">
create_user_id = #{record.createUserId},
</if>
<if test="record.updateUserId != null and record.updateUserId != ''">
update_user_id = #{record.updateUserId},
</if>
<if test="record.content != null and record.content != ''">
content = #{record.content},
</if>
</set>
where id = #{record.id}
</update>
<update id="deleteSelective">
update hy_content_info
<set>
deleted = 1
</set>
where id = #{contentId}
</update>
<select id="queryContentList" resultMap="HyContentInfoVOList">
select <include refid="Base_Column_List"></include>, update_user_id updateUserId
from hy_content_info
where deleted = 0
<if test="contentTitle != null and contentTitle != ''">
and content_title like concat('%', #{contentTitle}, '%')
</if>
<if test="subject != null">
and subject = #{subject}
</if>
<if test="contentType != null">
and content_type = #{contentType}
</if>
<if test="startTime != null and startTime != ''">
and update_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and update_time &lt;= #{endTime}
</if>
order by update_time desc
</select>
<select id="getUpdateUserName" resultType="string">
select name
from enterprise_user
where deleted = 0
and user_id = #{updateUserId}
</select>
<select id="getUpdateUserPhone" resultType="string">
select mobile
from enterprise_user
where deleted = 0
and user_id = #{updateUserId}
</select>
<!-- C 端使用的动态查询 -->
<select id="queryContentListForC" resultType="com.cool.store.vo.HyContentInfoVO">
select <include refid="Base_Column_List"></include>
from hy_content_info
where deleted = 0
and status = 0
<if test="contentTitle != null and contentTitle != ''">
and content_title like concat('%', #{contentTitle}, '%')
</if>
<if test="subject != null">
and subject = #{subject}
</if>
<if test="contentType != null">
and content_type = #{contentType}
</if>
<if test="startTime != null and startTime != ''">
and update_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and update_time &lt;= #{endTime}
</if>
order by update_time desc
</select>
<!-- 查询动态详情 -->
<select id="queryContentInfo" resultType="com.cool.store.entity.HyContentInfoDO">
select <include refid="Base_Column_List"></include>
from hy_content_info
where deleted = 0
and id = #{contentId}
</select>
<!-- 标题是否重复 -->
<select id="whetherTitleDuplicated" resultType="java.lang.Boolean">
SELECT COUNT(*)
FROM hy_content_info
WHERE deleted = 0
AND content_title = #{contentTitle}
</select>
<!-- 获取所有标题 -->
<select id="queryTitles" resultType="java.lang.String">
SELECT content_title
FROM hy_content_info
WHERE deleted = 0
</select>
</mapper>

View File

@@ -0,0 +1,311 @@
<?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.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" />
</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
<include refid="Base_Column_List"></include>
from hy_open_area_info where id = #{id}
</select>
<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">
parent_id,
</if>
<if test="record.areaName != null">
area_name,
</if>
<if test="record.areaPath != null">
area_path,
</if>
<if test="record.backgroundBanner != null">
background_banner,
</if>
<if test="record.detailBanner != null">
detail_banner,
</if>
<if test="record.areaStatus != null">
area_status,
</if>
<if test="record.deleted != null">
deleted,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.updateUserId != null">
update_user_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.parentId != null">
#{record.parentId},
</if>
<if test="record.areaName != null">
#{record.areaName},
</if>
<if test="record.areaPath != null">
#{record.areaPath},
</if>
<if test="record.backgroundBanner != null">
#{record.backgroundBanner},
</if>
<if test="record.detailBanner != null">
#{record.detailBanner},
</if>
<if test="record.areaStatus != null">
#{record.areaStatus},
</if>
<if test="record.deleted != null">
#{record.deleted},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.updateUserId != null">
#{record.updateUserId},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_open_area_info
<set>
<if test="record.parentId != null">
parent_id = #{record.parentId},
</if>
<if test="record.areaName != null">
area_name = #{record.areaName},
</if>
<if test="record.areaPath != null">
area_path = #{record.areaPath},
</if>
<if test="record.backgroundBanner != null">
background_banner = #{record.backgroundBanner},
</if>
<if test="record.detailBanner != null">
detail_banner = #{record.detailBanner},
</if>
<if test="record.areaStatus != null">
area_status = #{record.areaStatus},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.updateUserId != null">
update_user_id = #{record.updateUserId},
</if>
</set>
where id = #{record.id}
</update>
<update id="batchUpdateById">
update hy_open_area_info
<set>
<if test="backgroundBanner != null">
background_banner = #{backgroundBanner},
</if>
<if test="detailBanner != null">
detail_banner = #{detailBanner},
</if>
<if test="areaStatus != null">
area_status = #{areaStatus},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
</set>
<where>
<if test="ids !=null and ids.size>0">
<foreach collection="ids" item="id" open="and id in (" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
</update>
<update id="batchUpdateByParentId">
update hy_open_area_info
<set>
<if test="backgroundBanner != null">
background_banner = #{backgroundBanner},
</if>
<if test="detailBanner != null">
detail_banner = #{detailBanner},
</if>
<if test="areaStatus != null">
area_status = #{areaStatus},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
</set>
<where>
<if test="parentIdList !=null and parentIdList.size>0">
<foreach collection="parentIdList" item="parentId" open="and parent_id in (" close=")" separator=",">
#{parentId}
</foreach>
</if>
</where>
</update>
<select id="queryKeyOpenArea" resultMap="BaseResultMap">
select * from
hy_open_area_info
where area_status = 'keyOpen'
and province_city_flag = 1
and parent_id is not null
</select>
<select id="queryByKeyword" resultMap="BaseResultMap">
select * from
hy_open_area_info
<where>
<if test="keyword!=null and keyword!=''">
and area_path like concat('%',#{keyword},'%')
</if>
<if test="applyFlag!=null and applyFlag==true">
and (area_status = 'open' or area_status = 'keyOpen')
</if>
<if test="areaStatus!=null and areaStatus!=''">
and area_status = #{areaStatus}
</if>
<if test="filterData!=null and filterData==true">
and province_city_flag = 1
</if>
</where>
</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="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>
<select id="getChildrenCount" resultType="java.lang.Integer">
select count(1) 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>
<select id="selectByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from hy_open_area_info
<where>
<if test="idList !=null and idList.size>0">
<foreach collection="idList" item="id" open="and id in (" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
</select>
<select id="getAllOpenArea" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from hy_open_area_info
</select>
<select id="filterLeafNode" resultType="long">
select
id
from
hy_open_area_info
where
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
<include refid="Base_Column_List"></include>
FROM hy_open_area_info
WHERE parent_id = #{id}
</select>
<select id="getProvinceAllCode" resultMap="BaseResultMap">
SELECT b.* FROM `hy_open_area_info` a inner join hy_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 `hy_open_area_info`
WHERE area_path= concat('/',#{areaPath},'/') and deleted=0 and province_city_flag=0
</select>
<select id="selectAllCity" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"></include>
FROM `hy_open_area_info`
WHERE deleted=0 and province_city_flag = 1 and parent_id is not null
</select>
</mapper>

View File

@@ -0,0 +1,237 @@
<?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.HyPartnerLabelGroupMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerLabelGroupDO">
<id column="id" property="id" />
<result column="label_group_name" property="labelGroupName" />
<result column="deleted" property="deleted" />
<result column="edit_user_id" property="editUserId" />
<result column="edit_date" property="editDate" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="create_user_id" property="createUserId" />
<result column="update_user_id" property="updateUserId" />
<result column="remark" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, label_group_name, deleted, edit_user_id, edit_date, create_time, update_time,
create_user_id, update_user_id, remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from hy_partner_label_group
where id = #{id}
order by create_time
</select>
<select id="selectSelective" resultType="com.cool.store.entity.HyPartnerLabelGroupDO">
select <include refid="Base_Column_List"></include>
from hy_partner_label_group
where deleted = 0
<if test="labelGroupName != null and labelGroupName != ''">
and label_group_name = #{labelGroupName}
</if>
<if test="editUserId != null">
and edit_user_id = #{editUserId}
</if>
<if test="editDate != null">
and edit_date = #{editDate}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time =#{updateTime}
</if>
<if test="createUserId != null">
and create_user_id = #{createUserId}
</if>
<if test="updateUserId != null">
and update_user_id = #{updateUserId}
</if>
<if test="remark != null and remark != ''">
and remark like concat('%', #{remark}, '%')
</if>
order by create_time
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from hy_partner_label_group
where id = #{id}
<if test="id != null">
and id = #{id}
</if>
<if test="labelGroupName != null and labelGroupName != ''">
and label_group_name like concat('%', #{labelGroupName}, '%')
</if>
<if test="editUserId != null">
and edit_user_id = #{editUserId}
</if>
<if test="editDate != null">
and edit_date = #{editDate}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time =#{updateTime}
</if>
<if test="createUserId != null">
and create_user_id = #{createUserId}
</if>
<if test="updateUserId != null">
and update_user_id = #{updateUserId}
</if>
<if test="remark != null and remark != ''">
and remark like concat('%', #{remark}, '%')
</if>
</delete>
<insert id="insert" parameterType="com.cool.store.entity.HyPartnerLabelGroupDO">
insert into hy_partner_label_group (id, label_group_name, deleted,
edit_user_id, edit_date, create_time,
update_time, create_user_id, update_user_id,
remark)
values (#{id}, #{labelGroupName}, #{deleted},
#{editUserId}, #{editDate}, #{createTime},
#{updateTime}, #{createUserId}, #{updateUserId},
#{remark})
</insert>
<insert id="insertSelective" parameterType="com.cool.store.entity.HyPartnerLabelGroupDO">
insert into hy_partner_label_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="labelGroupName != null and labelGroupName != ''">
label_group_name,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="editUserId != null">
edit_user_id,
</if>
<if test="editDate != null">
edit_date,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="labelGroupName != null">
#{labelGroupName},
</if>
<if test="deleted != null">
#{deleted},
</if>
<if test="editUserId != null">
#{editUserId},
</if>
<if test="editDate != null">
#{editDate},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="createUserId != null">
#{createUserId},
</if>
<if test="updateUserId != null">
#{updateUserId},
</if>
<if test="remark != null">
#{remark},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyPartnerLabelGroupDO">
update hy_partner_label_group
<set>
<if test="labelGroupName != null">
label_group_name = #{labelGroupName},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
<if test="editUserId != null">
edit_user_id = #{editUserId},
</if>
<if test="editDate != null">
edit_date = #{editDate},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
<if test="remark != null">
remark = #{remark},
</if>
</set>
where id = #{id}
</update>
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyPartnerLabelGroupDO">
update hy_partner_label_group
set label_group_name = #{labelGroupName},
deleted = #{deleted},
edit_user_id = #{editUserId},
edit_date = #{editDate},
create_time = #{createTime},
update_time = #{updateTime},
create_user_id = #{createUserId},
update_user_id = #{updateUserId},
remark = #{remark}
where id = #{id}
</update>
<!-- 获取标签分组信息列表 -->
<select id="getLabelGroupList" resultType="com.cool.store.vo.LabelGroupListVo">
SELECT t1.id, t1.label_group_name, t2.`name` AS editName, t2.mobile AS editMobile, t1.edit_date
FROM hy_partner_label_group t1
LEFT JOIN enterprise_user t2 ON t1.edit_user_id = t2.user_id
WHERE t1.deleted = 0
<if test="labelGroupName != null and labelGroupName != ''">
AND t1.label_group_name LIKE CONCAT('%', #{labelGroupName}, '%')
</if>
ORDER BY t1.create_time DESC
</select>
<select id="getLabelGroupListOrder" resultType="com.cool.store.vo.LabelGroupListVo">
SELECT t1.id, t1.label_group_name, t2.`name` AS editName, t2.mobile AS editMobile, t1.edit_date
FROM hy_partner_label_group t1
LEFT JOIN enterprise_user t2 ON t1.edit_user_id = t2.user_id
WHERE t1.deleted = 0
<if test="labelGroupName != null and labelGroupName != ''">
AND t1.label_group_name LIKE CONCAT('%', #{labelGroupName}, '%')
</if>
ORDER BY t1.create_time,t1.id
</select>
</mapper>

View File

@@ -0,0 +1,234 @@
<?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.HyPartnerLabelMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerLabelDO">
<id column="id" property="id" />
<result column="label_group_id" property="labelGroupId" />
<result column="label_name" property="labelName" />
<result column="edit_user_id" property="editUserId" />
<result column="edit_date" property="editDate" />
<result column="deleted" property="deleted" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="create_user_id" property="createUserId" />
<result column="update_user_id" property="updateUserId" />
<result column="remark" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, label_group_id, label_name, edit_user_id, edit_date, deleted, create_time, update_time,
create_user_id, update_user_id, remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from hy_partner_label
where deleted = 0
and id = #{id}
order by create_time desc
</select>
<select id="selectSelective" resultType="com.cool.store.entity.HyPartnerLabelDO">
select <include refid="Base_Column_List"></include>
from hy_partner_label
where deleted = 0
<if test="labelGroupId != null">
and label_group_id = #{labelGroupId}
</if>
<if test="labelName != null and labelName != ''">
and label_name = #{labelName}
</if>
<if test="editUserId != null">
and edit_user_id = #{editUserId}
</if>
<if test="editDate != null">
and edit_date = #{editDate}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="createUserId != null">
and create_user_id = #{createUserId}
</if>
<if test="updateUserId != null">
and update_user_id = #{updateUserId}
</if>
<if test="remark != null">
and remark = #{remark}
</if>
order by create_time desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from hy_partner_label
where id = #{id}
</delete>
<insert id="insert" parameterType="com.cool.store.entity.HyPartnerLabelDO">
insert into hy_partner_label (id, label_group_id, label_name,
edit_user_id, edit_date, deleted,
create_time, update_time, create_user_id,
update_user_id, remark)
values (#{id}, #{labelGroupId}, #{labelName},
#{editUserId}, #{editDate}, #{deleted},
#{createTime}, #{updateTime}, #{createUserId},
#{updateUserId}, #{remark})
</insert>
<insert id="insertSelective" parameterType="com.cool.store.entity.HyPartnerLabelDO">
insert into hy_partner_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="labelGroupId != null">
label_group_id,
</if>
<if test="labelName != null">
label_name,
</if>
<if test="editUserId != null">
edit_user_id,
</if>
<if test="editDate != null">
edit_date,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="labelGroupId != null">
#{labelGroupId},
</if>
<if test="labelName != null">
#{labelName},
</if>
<if test="editUserId != null">
#{editUserId},
</if>
<if test="editDate != null">
#{editDate},
</if>
<if test="deleted != null">
#{deleted},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="createUserId != null">
#{createUserId},
</if>
<if test="updateUserId != null">
#{updateUserId},
</if>
<if test="remark != null">
#{remark},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyPartnerLabelDO">
update hy_partner_label
<set>
<if test="labelGroupId != null">
label_group_id = #{labelGroupId},
</if>
<if test="labelName != null and labelName != ''">
label_name = #{labelName},
</if>
<if test="editUserId != null">
edit_user_id = #{editUserId},
</if>
<if test="editDate != null">
edit_date = #{editDate},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
<if test="remark != null">
remark = #{remark}
</if>
</set>
where deleted = 0
and id = #{id}
</update>
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyPartnerLabelDO">
update hy_partner_label
set label_group_id = #{labelGroupId},
label_name = #{labelName},
edit_user_id = #{editUserId},
edit_date = #{editDate},
deleted = #{deleted},
create_time = #{createTime},
update_time = #{updateTime},
create_user_id = #{createUserId},
update_user_id = #{updateUserId},
remark = #{remark}
where id = #{id}
</update>
<select id="getLabelList" resultType="com.cool.store.vo.LabelListVo">
SELECT t1.id, t2.id AS labelGroupId, t1.label_name, t2.label_group_name, t3.`name` AS editName, t3.mobile AS editMobile, t1.edit_date,t1.create_time as labelCreateTime,t2.create_time AS groupCreateTime
FROM hy_partner_label t1
LEFT JOIN hy_partner_label_group t2 ON t1.label_group_id = t2.id
LEFT JOIN enterprise_user t3 ON t1.edit_user_id = t3.user_id
WHERE t1.deleted = 0 AND t2.deleted = 0
<if test="labelName != null and labelName != ''">
AND t1.label_name LIKE CONCAT('%', #{labelName} ,'%')
</if>
<if test="labelGroupId != null">
AND t2.id = #{labelGroupId}
</if>
ORDER BY t2.create_time asc ,t2.id asc
</select>
<select id="whetherGroupInUse" resultType="java.lang.Boolean">
SELECT COUNT(*)
FROM hy_partner_label
WHERE deleted = 0
AND label_group_id = #{labelGroupId}
</select>
<select id="getLabelListByIds" resultMap="BaseResultMap">
select * from hy_partner_label where deleted = 0
<if test="labelIds!=null and labelIds.size>0">
<foreach collection="labelIds" item="labelId" open="and id in (" close=")" separator=",">
#{labelId}
</foreach>
</if>
</select>
</mapper>