feat:装修配置表
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
package com.cool.store.dao.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||||
|
import com.cool.store.mapper.decoration.DecorationTeamConfigMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 15:07
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class DecorationTeamConfigDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DecorationTeamConfigMapper decorationTeamConfigMapper;
|
||||||
|
|
||||||
|
public void addTeam(DecorationTeamConfigDO decorationTeamConfigDO){
|
||||||
|
decorationTeamConfigMapper.insertSelective(decorationTeamConfigDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateTeam(DecorationTeamConfigDO decorationTeamConfigDO){
|
||||||
|
decorationTeamConfigMapper.updateByPrimaryKeySelective(decorationTeamConfigDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DecorationTeamConfigDO getById(Long id){
|
||||||
|
if (id == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return decorationTeamConfigMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.cool.store.dao.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.mapper.decoration.ShopDecorationAssignMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 15:07
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class ShopDecorationAssignDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopDecorationAssignMapper shopDecorationAssignMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.cool.store.dao.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.entity.decoration.TeamAreaMappingDO;
|
||||||
|
import com.cool.store.mapper.decoration.TeamAreaMappingMapper;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 15:08
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class TeamAreaMappingDAO {
|
||||||
|
|
||||||
|
private TeamAreaMappingMapper teamAreaMappingMapper;
|
||||||
|
|
||||||
|
public void batchInsert(Long teamId,List<Long> cityId){
|
||||||
|
if (teamId == null || CollectionUtils.isEmpty(cityId)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<TeamAreaMappingDO> list = new ArrayList<>();
|
||||||
|
cityId.forEach(x->{
|
||||||
|
TeamAreaMappingDO teamAreaMappingDO = new TeamAreaMappingDO();
|
||||||
|
teamAreaMappingDO.setTeamId(teamId);
|
||||||
|
teamAreaMappingDO.setOpenCityId(x);
|
||||||
|
list.add(teamAreaMappingDO);
|
||||||
|
});
|
||||||
|
teamAreaMappingMapper.batchInsert(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int deletedByTeamId(Long teamId){
|
||||||
|
if (teamId == null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return teamAreaMappingMapper.deletedByTeamId(teamId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int deletedIds(List<Long> ids){
|
||||||
|
if (CollectionUtils.isEmpty(ids)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return teamAreaMappingMapper.deletedIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.cool.store.mapper.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||||
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
|
||||||
|
public interface DecorationTeamConfigMapper extends Mapper<DecorationTeamConfigDO> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.cool.store.mapper.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.entity.decoration.ShopDecorationAssignDO;
|
||||||
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
|
||||||
|
public interface ShopDecorationAssignMapper extends Mapper<ShopDecorationAssignDO> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.cool.store.mapper.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.dto.decoration.TeamAreaMappingDTO;
|
||||||
|
import com.cool.store.entity.decoration.TeamAreaMappingDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TeamAreaMappingMapper extends Mapper<TeamAreaMappingDO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer batchInsert(@Param("list") List<TeamAreaMappingDO> list);
|
||||||
|
/**
|
||||||
|
* 根据团队id删除 更新团队id时候删除
|
||||||
|
* @param teamId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer deletedByTeamId(@Param("teamId") Long teamId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ids删除
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer deletedIds(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据城市id查询
|
||||||
|
* @param cityId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TeamAreaMappingDO getByCityId(@Param("cityId") Long cityId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据团队id批量查询
|
||||||
|
* @param teamIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TeamAreaMappingDTO> listByTeamIdList(@Param("teamIdList") List<Long> teamIdList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?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.decoration.DecorationTeamConfigMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.decoration.DecorationTeamConfigDO">
|
||||||
|
<!--
|
||||||
|
WARNING - @mbg.generated
|
||||||
|
-->
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
|
<result column="team_name" jdbcType="VARCHAR" property="teamName" />
|
||||||
|
<result column="team_code" jdbcType="VARCHAR" property="teamCode" />
|
||||||
|
<result column="use_system" jdbcType="TINYINT" property="useSystem" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="deleted" jdbcType="TINYINT" property="deleted" />
|
||||||
|
</resultMap>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?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.decoration.ShopDecorationAssignMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.decoration.ShopDecorationAssignDO">
|
||||||
|
<!--
|
||||||
|
WARNING - @mbg.generated
|
||||||
|
-->
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
|
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
|
||||||
|
<result column="decoration_desc_status" jdbcType="TINYINT" property="decorationDescStatus" />
|
||||||
|
<result column="decoration_team_id" jdbcType="BIGINT" property="decorationTeamId" />
|
||||||
|
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
|
||||||
|
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
||||||
|
</resultMap>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?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.decoration.TeamAreaMappingMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.decoration.TeamAreaMappingDO">
|
||||||
|
<!--
|
||||||
|
WARNING - @mbg.generated
|
||||||
|
-->
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
|
<result column="team_id" jdbcType="BIGINT" property="teamId" />
|
||||||
|
<result column="open_city_id" jdbcType="BIGINT" property="openCityId" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 批量插入 -->
|
||||||
|
<insert id="batchInsert" parameterType="java.util.List">
|
||||||
|
INSERT INTO zxjp_team_area_mapping (
|
||||||
|
team_id,
|
||||||
|
open_city_id
|
||||||
|
) VALUES
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.teamId},
|
||||||
|
#{item.openCityId}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 根据团队id删除 更新团队id时候删除 -->
|
||||||
|
<delete id="deletedByTeamId" parameterType="java.lang.Long">
|
||||||
|
DELETE FROM zxjp_team_area_mapping
|
||||||
|
WHERE team_id = #{teamId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!-- 根据ids删除 -->
|
||||||
|
<delete id="deletedIds" parameterType="java.util.List">
|
||||||
|
DELETE FROM zxjp_team_area_mapping
|
||||||
|
WHERE id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="getByCityId" parameterType="java.lang.Long" resultType="com.cool.store.entity.decoration.TeamAreaMappingDO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM zxjp_team_area_mapping
|
||||||
|
WHERE open_city_id = #{cityId}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listByTeamIdList" parameterType="java.util.List" resultType="com.cool.store.dto.decoration.TeamAreaMappingDTO">
|
||||||
|
SELECT
|
||||||
|
a.team_id as teamId,
|
||||||
|
a.open_city_id as openCityId,
|
||||||
|
b.area_name as openCityName
|
||||||
|
FROM zxjp_team_area_mapping a
|
||||||
|
left join xfsg_open_area_info b on a.open_city_id = b.id
|
||||||
|
WHERE a.team_id IN
|
||||||
|
<foreach collection="teamIdList" item="teamId" open="(" separator="," close=")">
|
||||||
|
#{teamId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.cool.store.dto.decoration;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 18:41
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DecorationTeamDTO {
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.cool.store.dto.decoration;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 19:01
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TeamAreaMappingDTO {
|
||||||
|
|
||||||
|
private Long teamId;
|
||||||
|
|
||||||
|
private Long openCityId;
|
||||||
|
|
||||||
|
private String openCityName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package com.cool.store.entity.decoration;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Table(name = "zxjp_decoration_team_config")
|
||||||
|
public class DecorationTeamConfigDO {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队名称
|
||||||
|
*/
|
||||||
|
@Column(name = "team_name")
|
||||||
|
private String teamName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队编号
|
||||||
|
*/
|
||||||
|
@Column(name = "team_code")
|
||||||
|
private String teamCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用系统(1-CRM,2-红圈通)
|
||||||
|
*/
|
||||||
|
@Column(name = "use_system")
|
||||||
|
private Integer useSystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(name = "create_time")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column(name = "update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除状态(0-正常,1-删除)
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取团队名称
|
||||||
|
*
|
||||||
|
* @return team_name - 团队名称
|
||||||
|
*/
|
||||||
|
public String getTeamName() {
|
||||||
|
return teamName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置团队名称
|
||||||
|
*
|
||||||
|
* @param teamName 团队名称
|
||||||
|
*/
|
||||||
|
public void setTeamName(String teamName) {
|
||||||
|
this.teamName = teamName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取团队编号
|
||||||
|
*
|
||||||
|
* @return team_code - 团队编号
|
||||||
|
*/
|
||||||
|
public String getTeamCode() {
|
||||||
|
return teamCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置团队编号
|
||||||
|
*
|
||||||
|
* @param teamCode 团队编号
|
||||||
|
*/
|
||||||
|
public void setTeamCode(String teamCode) {
|
||||||
|
this.teamCode = teamCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取使用系统(1-CRM,2-红圈通)
|
||||||
|
*
|
||||||
|
* @return use_system - 使用系统(1-CRM,2-红圈通)
|
||||||
|
*/
|
||||||
|
public Integer getUseSystem() {
|
||||||
|
return useSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置使用系统(1-CRM,2-红圈通)
|
||||||
|
*
|
||||||
|
* @param useSystem 使用系统(1-CRM,2-红圈通)
|
||||||
|
*/
|
||||||
|
public void setUseSystem(Integer useSystem) {
|
||||||
|
this.useSystem = useSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取创建时间
|
||||||
|
*
|
||||||
|
* @return create_time - 创建时间
|
||||||
|
*/
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置创建时间
|
||||||
|
*
|
||||||
|
* @param createTime 创建时间
|
||||||
|
*/
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取更新时间
|
||||||
|
*
|
||||||
|
* @return update_time - 更新时间
|
||||||
|
*/
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置更新时间
|
||||||
|
*
|
||||||
|
* @param updateTime 更新时间
|
||||||
|
*/
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取删除状态(0-正常,1-删除)
|
||||||
|
*
|
||||||
|
* @return deleted - 删除状态(0-正常,1-删除)
|
||||||
|
*/
|
||||||
|
public Integer getDeleted() {
|
||||||
|
return deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置删除状态(0-正常,1-删除)
|
||||||
|
*
|
||||||
|
* @param deleted 删除状态(0-正常,1-删除)
|
||||||
|
*/
|
||||||
|
public void setDeleted(Integer deleted) {
|
||||||
|
this.deleted = deleted;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.cool.store.entity.decoration;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Table(name = "zxjp_shop_decoration_assign")
|
||||||
|
public class ShopDecorationAssignDO {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装修团队id
|
||||||
|
*/
|
||||||
|
@Column(name = "shop_id")
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配状态(0-待分配,1-已分配)
|
||||||
|
*/
|
||||||
|
@Column(name = "decoration_desc_status")
|
||||||
|
private Byte decorationDescStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装修团队id
|
||||||
|
*/
|
||||||
|
@Column(name = "decoration_team_id")
|
||||||
|
private Long decorationTeamId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(name = "created_time")
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column(name = "updated_time")
|
||||||
|
private Date updatedTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取装修团队id
|
||||||
|
*
|
||||||
|
* @return shop_id - 装修团队id
|
||||||
|
*/
|
||||||
|
public Long getShopId() {
|
||||||
|
return shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置装修团队id
|
||||||
|
*
|
||||||
|
* @param shopId 装修团队id
|
||||||
|
*/
|
||||||
|
public void setShopId(Long shopId) {
|
||||||
|
this.shopId = shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分配状态(0-待分配,1-已分配)
|
||||||
|
*
|
||||||
|
* @return decoration_desc_status - 分配状态(0-待分配,1-已分配)
|
||||||
|
*/
|
||||||
|
public Byte getDecorationDescStatus() {
|
||||||
|
return decorationDescStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置分配状态(0-待分配,1-已分配)
|
||||||
|
*
|
||||||
|
* @param decorationDescStatus 分配状态(0-待分配,1-已分配)
|
||||||
|
*/
|
||||||
|
public void setDecorationDescStatus(Byte decorationDescStatus) {
|
||||||
|
this.decorationDescStatus = decorationDescStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取装修团队id
|
||||||
|
*
|
||||||
|
* @return decoration_team_id - 装修团队id
|
||||||
|
*/
|
||||||
|
public Long getDecorationTeamId() {
|
||||||
|
return decorationTeamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置装修团队id
|
||||||
|
*
|
||||||
|
* @param decorationTeamId 装修团队id
|
||||||
|
*/
|
||||||
|
public void setDecorationTeamId(Long decorationTeamId) {
|
||||||
|
this.decorationTeamId = decorationTeamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取创建时间
|
||||||
|
*
|
||||||
|
* @return created_time - 创建时间
|
||||||
|
*/
|
||||||
|
public Date getCreatedTime() {
|
||||||
|
return createdTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置创建时间
|
||||||
|
*
|
||||||
|
* @param createdTime 创建时间
|
||||||
|
*/
|
||||||
|
public void setCreatedTime(Date createdTime) {
|
||||||
|
this.createdTime = createdTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取更新时间
|
||||||
|
*
|
||||||
|
* @return updated_time - 更新时间
|
||||||
|
*/
|
||||||
|
public Date getUpdatedTime() {
|
||||||
|
return updatedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置更新时间
|
||||||
|
*
|
||||||
|
* @param updatedTime 更新时间
|
||||||
|
*/
|
||||||
|
public void setUpdatedTime(Date updatedTime) {
|
||||||
|
this.updatedTime = updatedTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.cool.store.entity.decoration;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Table(name = "zxjp_team_area_mapping")
|
||||||
|
public class TeamAreaMappingDO {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队ID
|
||||||
|
*/
|
||||||
|
@Column(name = "team_id")
|
||||||
|
private Long teamId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市ID
|
||||||
|
*/
|
||||||
|
@Column(name = "open_city_id")
|
||||||
|
private Long openCityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(name = "create_time")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取团队ID
|
||||||
|
*
|
||||||
|
* @return team_id - 团队ID
|
||||||
|
*/
|
||||||
|
public Long getTeamId() {
|
||||||
|
return teamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置团队ID
|
||||||
|
*
|
||||||
|
* @param teamId 团队ID
|
||||||
|
*/
|
||||||
|
public void setTeamId(Long teamId) {
|
||||||
|
this.teamId = teamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取城市ID
|
||||||
|
*
|
||||||
|
* @return open_city_id - 城市ID
|
||||||
|
*/
|
||||||
|
public Long getOpenCityId() {
|
||||||
|
return openCityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置城市ID
|
||||||
|
*
|
||||||
|
* @param openCityId 城市ID
|
||||||
|
*/
|
||||||
|
public void setOpenCityId(Long openCityId) {
|
||||||
|
this.openCityId = openCityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取创建时间
|
||||||
|
*
|
||||||
|
* @return create_time - 创建时间
|
||||||
|
*/
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置创建时间
|
||||||
|
*
|
||||||
|
* @param createTime 创建时间
|
||||||
|
*/
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.cool.store.request.decoration;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 16:13
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddTeamRequest {
|
||||||
|
@ApiModelProperty("团队名称")
|
||||||
|
private String teamName;
|
||||||
|
@ApiModelProperty("负责区域列表 直传市ID,选择省时,将市Id全部传入")
|
||||||
|
private List<Long> openCityIdList;
|
||||||
|
@ApiModelProperty("团队名称")
|
||||||
|
private Integer userSystem;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.cool.store.request.decoration;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 16:16
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UpdateTeamRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty("ID")
|
||||||
|
private Long id;
|
||||||
|
@ApiModelProperty("团队名称")
|
||||||
|
private String teamCode;
|
||||||
|
@ApiModelProperty("团队名称")
|
||||||
|
private String teamName;
|
||||||
|
@ApiModelProperty("负责区域列表 直传市ID,选择省时,将市Id全部传入")
|
||||||
|
private List<Long> openCityIdList;
|
||||||
|
@ApiModelProperty("团队名称")
|
||||||
|
private Integer userSystem;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.request.decoration.AddTeamRequest;
|
||||||
|
import com.cool.store.request.decoration.UpdateTeamRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 15:54
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public interface DecorationHandleService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增团队
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean addTeam(AddTeamRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改团队
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean update(UpdateTeamRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除团队
|
||||||
|
* @param teamId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean deleteByTeamId(Long teamId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.dao.decoration.DecorationTeamConfigDAO;
|
||||||
|
import com.cool.store.dao.decoration.TeamAreaMappingDAO;
|
||||||
|
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.request.decoration.AddTeamRequest;
|
||||||
|
import com.cool.store.request.decoration.UpdateTeamRequest;
|
||||||
|
import com.cool.store.service.DecorationHandleService;
|
||||||
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
|
import com.cool.store.utils.StringUtil;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/10/29 15:55
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DecorationHandleServiceImpl implements DecorationHandleService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DecorationTeamConfigDAO decorationTeamConfigDAO;
|
||||||
|
@Resource
|
||||||
|
private TeamAreaMappingDAO teamAreaMappingDAO;
|
||||||
|
@Resource
|
||||||
|
RedisUtilPool redisUtilPool;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean addTeam(AddTeamRequest request) {
|
||||||
|
//校验
|
||||||
|
if (Objects.isNull(request)||CollectionUtils.isEmpty(request.getOpenCityIdList()) || StringUtil.isEmpty(request.getTeamName())){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||||
|
}
|
||||||
|
//先删除城市团队关系
|
||||||
|
teamAreaMappingDAO.deletedIds(request.getOpenCityIdList());
|
||||||
|
|
||||||
|
DecorationTeamConfigDO decorationTeamConfigDO = new DecorationTeamConfigDO();
|
||||||
|
decorationTeamConfigDO.setTeamName(request.getTeamName());
|
||||||
|
decorationTeamConfigDO.setTeamCode(getNextNumber());
|
||||||
|
decorationTeamConfigDO.setUseSystem(request.getUserSystem());
|
||||||
|
decorationTeamConfigDAO.addTeam(decorationTeamConfigDO);
|
||||||
|
teamAreaMappingDAO.batchInsert(decorationTeamConfigDO.getId(),request.getOpenCityIdList());
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(UpdateTeamRequest request) {
|
||||||
|
if (request.getId() == null||CollectionUtils.isEmpty(request.getOpenCityIdList()) || StringUtil.isEmpty(request.getTeamName())){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||||
|
}
|
||||||
|
DecorationTeamConfigDO teamConfigDO = decorationTeamConfigDAO.getById(request.getId());
|
||||||
|
if (teamConfigDO==null){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
teamConfigDO.setTeamName(request.getTeamName());
|
||||||
|
teamConfigDO.setUseSystem(request.getUserSystem());
|
||||||
|
decorationTeamConfigDAO.updateTeam(teamConfigDO);
|
||||||
|
//删除团队城市关系
|
||||||
|
teamAreaMappingDAO.deletedByTeamId(teamConfigDO.getId());
|
||||||
|
//新增更新之后的团队城市关系
|
||||||
|
teamAreaMappingDAO.batchInsert(teamConfigDO.getId(),request.getOpenCityIdList());
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteByTeamId(Long teamId) {
|
||||||
|
DecorationTeamConfigDO teamConfigDO = decorationTeamConfigDAO.getById(teamId);
|
||||||
|
if (teamConfigDO==null){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
teamConfigDO.setDeleted(1);
|
||||||
|
teamAreaMappingDAO.deletedByTeamId(teamId);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getNextNumber() {
|
||||||
|
Long current = redisUtilPool.incrby("counter_key", 1);
|
||||||
|
if (current == 1) {
|
||||||
|
// 如果是第一次,重新设置为 1(因为 increment 从 0 开始)
|
||||||
|
redisUtilPool.setString("counter_key", "1");
|
||||||
|
current = 1L;
|
||||||
|
}
|
||||||
|
return String.format("TD%04d", current);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user