Browse Source

区域更新

LiRong 4 days ago
parent
commit
fd35ae7cd4

+ 32 - 2
leromro-admin/src/main/java/com/leromro/web/controller/system/SysDeptController.java

@@ -4,8 +4,13 @@ import java.math.BigDecimal;
 import java.util.List;
 
 import com.leromro.common.core.domain.R;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.leromro.core.domain.DeptRegionManagement;
+import com.leromro.core.domain.vo.DeptInfoVO;
+import com.leromro.core.service.IDeptRegionManagementService;
 import io.swagger.annotations.Api;
 import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -31,6 +36,8 @@ public class SysDeptController extends BaseController
 {
     @Autowired
     private ISysDeptService deptService;
+    @Autowired
+    private IDeptRegionManagementService deptRegionManagementService;
 
     /**
      * 获取部门列表
@@ -56,14 +63,19 @@ public class SysDeptController extends BaseController
     }
 
     /**
-     * 根据部门编号获取详细信息
+     * 根据部门编号获取详细信息,并且获取部门所管理的区域的列表
      */
     @PreAuthorize("@ss.hasPermi('system:dept:query')")
     @GetMapping(value = "/{deptId}")
     public AjaxResult getInfo(@PathVariable Long deptId)
     {
         deptService.checkDeptDataScope(deptId);
-        return success(deptService.selectDeptById(deptId));
+        SysDept sysDept = deptService.selectDeptById(deptId);
+        List<DeptRegionManagement> list = deptRegionManagementService.list(new LambdaQueryWrapper<DeptRegionManagement>().eq(DeptRegionManagement::getDeptId, deptId));
+        DeptInfoVO deptInfoVO = new DeptInfoVO();
+        BeanUtils.copyProperties(sysDept,deptInfoVO);
+        deptInfoVO.setDeptRegionList(list);
+        return success(deptInfoVO);
     }
 
     /**
@@ -77,6 +89,9 @@ public class SysDeptController extends BaseController
         if (!deptService.checkDeptNameUnique(dept))
         {
             return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+        } else
+        if (dept.getDistributionRatio() == null) {
+            throw new RuntimeException("新增公司未设置分账比例");
         }
         dept.setCreateBy(getUsername());
         return toAjax(deptService.insertDept(dept));
@@ -136,4 +151,19 @@ public class SysDeptController extends BaseController
         deptService.updateDistributionRatio(ids,ratio);
         return R.ok();
     }
+/*    @PostMapping("/pointList/{deptId}")
+    public R updateDeptPointList(String pointList,@PathVariable Long deptId){
+        SysDept sysDept = new SysDept();
+        sysDept.setPointList(pointList);
+        sysDept.setDeptId(deptId);
+        deptService.updateDeptPointList(sysDept);
+        return R.ok();
+    }*/
+
+    @GetMapping("/pointList")
+    public R<String> getDeptListById(Long deptId){
+
+        String pointList = deptService.getPointList(deptId);
+        return R.ok(pointList);
+    }
 }

+ 14 - 4
leromro-common/src/main/java/com/leromro/common/core/domain/entity/SysDept.java

@@ -94,6 +94,16 @@ public class SysDept extends BaseEntity
     private String districtName;
 
 
+
+
+    public BigDecimal getDistributionRatio() {
+        return distributionRatio;
+    }
+
+    public void setDistributionRatio(BigDecimal distributionRatio) {
+        this.distributionRatio = distributionRatio;
+    }
+
     public String getPointList() {
         return pointList;
     }
@@ -281,15 +291,15 @@ public class SysDept extends BaseEntity
         this.delFlag = delFlag;
     }
 
-    public String getParentName()
+ /*   public String getParentName()
     {
         return parentName;
-    }
+    }*/
 
-    public void setParentName(String parentName)
+/*    public void setParentName(String parentName)
     {
         this.parentName = parentName;
-    }
+    }*/
 
     public List<SysDept> getChildren()
     {

+ 117 - 0
leromro-core/src/main/java/com/leromro/core/controller/DeptRegionManagementController.java

@@ -0,0 +1,117 @@
+package com.leromro.core.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.leromro.common.core.domain.R;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.leromro.common.annotation.Log;
+import com.leromro.common.core.controller.BaseController;
+import com.leromro.common.core.domain.AjaxResult;
+import com.leromro.common.enums.BusinessType;
+import com.leromro.core.domain.DeptRegionManagement;
+import com.leromro.core.service.IDeptRegionManagementService;
+import com.leromro.common.utils.poi.ExcelUtil;
+import com.leromro.common.core.page.TableDataInfo;
+
+/**
+ * 公司管理地区Controller
+ * 
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+@RestController
+@Api(tags = "公司管理地区")
+@RequestMapping("/core/dept/region-management")
+public class DeptRegionManagementController extends BaseController
+{
+    @Autowired
+    private IDeptRegionManagementService deptRegionManagementService;
+
+    /**
+     * 查询公司管理地区列表
+     */
+    @ApiOperation("查询公司管理地区列表")
+    @PreAuthorize("@ss.hasPermi('core:dept:region-management:list')")
+    @GetMapping("/list")
+    public TableDataInfo<DeptRegionManagement> list(DeptRegionManagement deptRegionManagement)
+    {
+        startPage();
+        List<DeptRegionManagement> list = deptRegionManagementService.selectDeptRegionManagementList(deptRegionManagement);
+        return getDataTable(list);
+    }
+
+
+
+    /**
+     * 获取公司管理地区详细信息
+     */
+    @ApiOperation("获取公司管理地区详细信息")
+    @PreAuthorize("@ss.hasPermi('core:dept:region-management:query')")
+    @GetMapping(value = "/{regionManagementId}")
+    public R<DeptRegionManagement> getInfo(@PathVariable("regionManagementId") Long regionManagementId)
+    {
+        return R.ok(deptRegionManagementService.selectDeptRegionManagementByRegionManagementId(regionManagementId));
+    }
+
+    /**
+     * 新增公司管理地区
+     */
+    @ApiOperation("新增公司管理地区")
+    @PreAuthorize("@ss.hasPermi('core:dept:region-management:add')")
+    @Log(title = "公司管理地区", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DeptRegionManagement deptRegionManagement)
+    {
+        return toAjax(deptRegionManagementService.insertDeptRegionManagement(deptRegionManagement));
+    }
+
+    /**
+     * 修改公司管理地区
+     */
+    @ApiOperation("修改公司管理地区")
+    @PreAuthorize("@ss.hasPermi('core:dept:region-management:edit')")
+    @Log(title = "公司管理地区", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody DeptRegionManagement deptRegionManagement)
+    {
+        return toAjax(deptRegionManagementService.updateDeptRegionManagement(deptRegionManagement));
+    }
+
+    /**
+     * 删除公司管理地区
+     */
+    @ApiOperation("删除公司管理地区")
+    @PreAuthorize("@ss.hasPermi('core:dept:region-management:remove')")
+    @Log(title = "公司管理地区", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{regionManagementIds}")
+    public R<Integer> remove(@PathVariable Long[] regionManagementIds)
+    {
+        return R.ok(deptRegionManagementService.deleteDeptRegionManagementByRegionManagementIds(regionManagementIds));
+    }
+
+    /**
+     * 导出公司管理地区列表
+     */
+    @ApiOperation("导出公司管理地区列表")
+    @PreAuthorize("@ss.hasPermi('core:dept:region-management:export')")
+    @Log(title = "公司管理地区", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, DeptRegionManagement deptRegionManagement)
+    {
+        List<DeptRegionManagement> list = deptRegionManagementService.selectDeptRegionManagementList(deptRegionManagement);
+        ExcelUtil<DeptRegionManagement> util = new ExcelUtil<DeptRegionManagement>(DeptRegionManagement.class);
+        util.exportExcel(response, list, "公司管理地区数据");
+    }
+}

+ 77 - 0
leromro-core/src/main/java/com/leromro/core/domain/DeptRegionManagement.java

@@ -0,0 +1,77 @@
+package com.leromro.core.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.leromro.common.annotation.Excel;
+import com.leromro.common.core.domain.BaseEntity;
+
+import java.util.List;
+
+/**
+ * 公司管理地区对象 l_dept_region_management
+ * 
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@TableName("l_dept_region_management")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "DeptRegionManagement", description = "公司管理地区")
+public class DeptRegionManagement extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    @TableField("region_management_id")
+    @ApiModelProperty("主键id")
+    private Long regionManagementId;
+
+    @TableField("dept_id")
+    @ApiModelProperty("公司id")
+    private Long deptId;
+
+    @TableField("dept_name")
+    @ApiModelProperty("公司名称")
+    private String deptName;
+
+    @TableField("area_type")
+    @ApiModelProperty("区域公司类型")
+    private String areaType;
+
+    @TableField("point_list")
+    @ApiModelProperty("描点集合")
+    private String pointList;
+
+    private Integer delFlag;
+
+    @TableField("province_code")
+    @ApiModelProperty("省级区划编号")
+    private String provinceCode;
+
+    @TableField("province_name")
+    @ApiModelProperty("省级名称")
+    private String provinceName;
+
+    @TableField("city_code")
+    @ApiModelProperty("市级编号")
+    private String cityCode;
+
+    @TableField("city_name")
+    @ApiModelProperty("市级名称")
+    private String cityName;
+
+    @TableField("district_code")
+    @ApiModelProperty("区级区划编号")
+    private String districtCode;
+
+    @TableField("district_name")
+    @ApiModelProperty("区级名称")
+    private String districtName;
+}

+ 14 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/DeptInfoVO.java

@@ -0,0 +1,14 @@
+package com.leromro.core.domain.vo;
+
+import com.leromro.common.core.domain.entity.SysDept;
+import com.leromro.core.domain.DeptRegionManagement;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+@Getter
+@Setter
+public class DeptInfoVO extends SysDept {
+    private List<DeptRegionManagement> deptRegionList;
+}

+ 62 - 0
leromro-core/src/main/java/com/leromro/core/mapper/DeptRegionManagementMapper.java

@@ -0,0 +1,62 @@
+package com.leromro.core.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.leromro.core.domain.DeptRegionManagement;
+
+/**
+ * 公司管理地区Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+public interface DeptRegionManagementMapper extends BaseMapper<DeptRegionManagement>
+{
+    /**
+     * 查询公司管理地区
+     * 
+     * @param regionManagementId 公司管理地区主键
+     * @return 公司管理地区
+     */
+    public DeptRegionManagement selectDeptRegionManagementByRegionManagementId(Long regionManagementId);
+
+    /**
+     * 查询公司管理地区列表
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 公司管理地区集合
+     */
+    public List<DeptRegionManagement> selectDeptRegionManagementList(DeptRegionManagement deptRegionManagement);
+
+    /**
+     * 新增公司管理地区
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 结果
+     */
+    public int insertDeptRegionManagement(DeptRegionManagement deptRegionManagement);
+
+    /**
+     * 修改公司管理地区
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 结果
+     */
+    public int updateDeptRegionManagement(DeptRegionManagement deptRegionManagement);
+
+    /**
+     * 删除公司管理地区
+     * 
+     * @param regionManagementId 公司管理地区主键
+     * @return 结果
+     */
+    public int deleteDeptRegionManagementByRegionManagementId(Long regionManagementId);
+
+    /**
+     * 批量删除公司管理地区
+     * 
+     * @param regionManagementIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteDeptRegionManagementByRegionManagementIds(Long[] regionManagementIds);
+}

+ 62 - 0
leromro-core/src/main/java/com/leromro/core/service/IDeptRegionManagementService.java

@@ -0,0 +1,62 @@
+package com.leromro.core.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.leromro.core.domain.DeptRegionManagement;
+
+/**
+ * 公司管理地区Service接口
+ * 
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+public interface IDeptRegionManagementService extends IService<DeptRegionManagement>
+{
+    /**
+     * 查询公司管理地区
+     * 
+     * @param regionManagementId 公司管理地区主键
+     * @return 公司管理地区
+     */
+    public DeptRegionManagement selectDeptRegionManagementByRegionManagementId(Long regionManagementId);
+
+    /**
+     * 查询公司管理地区列表
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 公司管理地区集合
+     */
+    public List<DeptRegionManagement> selectDeptRegionManagementList(DeptRegionManagement deptRegionManagement);
+
+    /**
+     * 新增公司管理地区
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 结果
+     */
+    public Boolean insertDeptRegionManagement(DeptRegionManagement deptRegionManagement);
+
+    /**
+     * 修改公司管理地区
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 结果
+     */
+    public Boolean updateDeptRegionManagement(DeptRegionManagement deptRegionManagement);
+
+    /**
+     * 批量删除公司管理地区
+     * 
+     * @param regionManagementIds 需要删除的公司管理地区主键集合
+     * @return 结果
+     */
+    public int deleteDeptRegionManagementByRegionManagementIds(Long[] regionManagementIds);
+
+    /**
+     * 删除公司管理地区信息
+     * 
+     * @param regionManagementId 公司管理地区主键
+     * @return 结果
+     */
+    public int deleteDeptRegionManagementByRegionManagementId(Long regionManagementId);
+}

+ 96 - 0
leromro-core/src/main/java/com/leromro/core/service/impl/DeptRegionManagementServiceImpl.java

@@ -0,0 +1,96 @@
+package com.leromro.core.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.leromro.core.mapper.DeptRegionManagementMapper;
+import com.leromro.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.leromro.core.mapper.DeptRegionManagementMapper;
+import com.leromro.core.domain.DeptRegionManagement;
+import com.leromro.core.service.IDeptRegionManagementService;
+
+/**
+ * 公司管理地区Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2025-05-14
+ */
+@Service
+public class DeptRegionManagementServiceImpl extends ServiceImpl<DeptRegionManagementMapper, DeptRegionManagement> implements IDeptRegionManagementService
+{
+    @Autowired
+    private DeptRegionManagementMapper deptRegionManagementMapper;
+
+    /**
+     * 查询公司管理地区
+     * 
+     * @param regionManagementId 公司管理地区主键
+     * @return 公司管理地区
+     */
+    @Override
+    public DeptRegionManagement selectDeptRegionManagementByRegionManagementId(Long regionManagementId)
+    {
+        return deptRegionManagementMapper.selectDeptRegionManagementByRegionManagementId(regionManagementId);
+    }
+
+    /**
+     * 查询公司管理地区列表
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 公司管理地区
+     */
+    @Override
+    public List<DeptRegionManagement> selectDeptRegionManagementList(DeptRegionManagement deptRegionManagement)
+    {
+        return deptRegionManagementMapper.selectDeptRegionManagementList(deptRegionManagement);
+    }
+
+    /**
+     * 新增公司管理地区
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 结果
+     */
+    @Override
+    public Boolean insertDeptRegionManagement(DeptRegionManagement deptRegionManagement)
+    {
+        return this.save(deptRegionManagement);
+    }
+
+    /**
+     * 修改公司管理地区
+     * 
+     * @param deptRegionManagement 公司管理地区
+     * @return 结果
+     */
+    @Override
+    public Boolean updateDeptRegionManagement(DeptRegionManagement deptRegionManagement)
+    {
+        return this.updateById(deptRegionManagement);
+    }
+
+    /**
+     * 批量删除公司管理地区
+     * 
+     * @param regionManagementIds 需要删除的公司管理地区主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDeptRegionManagementByRegionManagementIds(Long[] regionManagementIds)
+    {
+        return deptRegionManagementMapper.deleteDeptRegionManagementByRegionManagementIds(regionManagementIds);
+    }
+
+    /**
+     * 删除公司管理地区信息
+     * 
+     * @param regionManagementId 公司管理地区主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDeptRegionManagementByRegionManagementId(Long regionManagementId)
+    {
+        return deptRegionManagementMapper.deleteDeptRegionManagementByRegionManagementId(regionManagementId);
+    }
+}

+ 128 - 0
leromro-core/src/main/resources/mapper/core/DeptRegionManagementMapper.xml

@@ -0,0 +1,128 @@
+<?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.leromro.core.mapper.DeptRegionManagementMapper">
+    
+    <resultMap type="DeptRegionManagement" id="DeptRegionManagementResult">
+        <result property="regionManagementId"    column="region_management_id"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="deptName"    column="dept_name"    />
+        <result property="areaType"    column="area_type"    />
+        <result property="pointList"    column="point_list"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="provinceCode"    column="province_code"    />
+        <result property="provinceName"    column="province_name"    />
+        <result property="cityCode"    column="city_code"    />
+        <result property="cityName"    column="city_name"    />
+        <result property="districtCode"    column="district_code"    />
+        <result property="districtName"    column="district_name"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectDeptRegionManagementVo">
+        select region_management_id, dept_id, dept_name, area_type, point_list, del_flag, province_code, province_name, city_code, city_name, district_code, district_name, create_time, create_by, update_time, update_by, remark from l_dept_region_management
+    </sql>
+
+    <select id="selectDeptRegionManagementList" parameterType="DeptRegionManagement" resultMap="DeptRegionManagementResult">
+        <include refid="selectDeptRegionManagementVo"/>
+        <where>  
+            <if test="regionManagementId != null "> and region_management_id = #{regionManagementId}</if>
+            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
+            <if test="areaType != null  and areaType != ''"> and area_type = #{areaType}</if>
+            <if test="pointList != null  and pointList != ''"> and point_list = #{pointList}</if>
+            <if test="provinceCode != null  and provinceCode != ''"> and province_code = #{provinceCode}</if>
+            <if test="provinceName != null  and provinceName != ''"> and province_name like concat('%', #{provinceName}, '%')</if>
+            <if test="cityCode != null  and cityCode != ''"> and city_code = #{cityCode}</if>
+            <if test="cityName != null  and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
+            <if test="districtCode != null  and districtCode != ''"> and district_code = #{districtCode}</if>
+            <if test="districtName != null  and districtName != ''"> and district_name like concat('%', #{districtName}, '%')</if>
+        </where>
+    </select>
+    
+    <select id="selectDeptRegionManagementByRegionManagementId" parameterType="Long" resultMap="DeptRegionManagementResult">
+        <include refid="selectDeptRegionManagementVo"/>
+        where region_management_id = #{regionManagementId}
+    </select>
+
+    <insert id="insertDeptRegionManagement" parameterType="DeptRegionManagement">
+        insert into l_dept_region_management
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="regionManagementId != null">region_management_id,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="deptName != null">dept_name,</if>
+            <if test="areaType != null">area_type,</if>
+            <if test="pointList != null">point_list,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="provinceCode != null">province_code,</if>
+            <if test="provinceName != null">province_name,</if>
+            <if test="cityCode != null">city_code,</if>
+            <if test="cityName != null">city_name,</if>
+            <if test="districtCode != null">district_code,</if>
+            <if test="districtName != null">district_name,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="regionManagementId != null">#{regionManagementId},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="deptName != null">#{deptName},</if>
+            <if test="areaType != null">#{areaType},</if>
+            <if test="pointList != null">#{pointList},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="provinceCode != null">#{provinceCode},</if>
+            <if test="provinceName != null">#{provinceName},</if>
+            <if test="cityCode != null">#{cityCode},</if>
+            <if test="cityName != null">#{cityName},</if>
+            <if test="districtCode != null">#{districtCode},</if>
+            <if test="districtName != null">#{districtName},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateDeptRegionManagement" parameterType="DeptRegionManagement">
+        update l_dept_region_management
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="areaType != null">area_type = #{areaType},</if>
+            <if test="pointList != null">point_list = #{pointList},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="provinceCode != null">province_code = #{provinceCode},</if>
+            <if test="provinceName != null">province_name = #{provinceName},</if>
+            <if test="cityCode != null">city_code = #{cityCode},</if>
+            <if test="cityName != null">city_name = #{cityName},</if>
+            <if test="districtCode != null">district_code = #{districtCode},</if>
+            <if test="districtName != null">district_name = #{districtName},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where region_management_id = #{regionManagementId}
+    </update>
+
+    <delete id="deleteDeptRegionManagementByRegionManagementId" parameterType="Long">
+        delete from l_dept_region_management where region_management_id = #{regionManagementId}
+    </delete>
+
+    <delete id="deleteDeptRegionManagementByRegionManagementIds" parameterType="Long">
+        delete from l_dept_region_management where region_management_id in 
+        <foreach item="regionManagementId" collection="array" open="(" separator="," close=")">
+            #{regionManagementId}
+        </foreach>
+    </delete>
+</mapper>

+ 4 - 0
leromro-system/src/main/java/com/leromro/system/mapper/SysDeptMapper.java

@@ -119,4 +119,8 @@ public interface SysDeptMapper extends BaseMapper<SysDept>
     public int deleteDeptById(Long deptId);
 
     List<SysDept> getAllOrgList();
+
+    List<SysDept> getAlldept();
+
+    String selectPointList(Long deptId);
 }

+ 23 - 1
leromro-system/src/main/java/com/leromro/system/service/impl/SysDeptServiceImpl.java

@@ -40,6 +40,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
 
     @Autowired
     private SysRoleMapper roleMapper;
+    @Autowired
+    private SysDeptMapper sysDeptMapper;
 
     /**
      * 查询部门管理数据
@@ -63,7 +65,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
     @Override
     public List<TreeSelect> selectDeptTreeList(SysDept dept)
     {
-        SysDept sysDept = deptMapper.selectDeptById(SecurityUtils.getDeptId());
+        Long deptId = SecurityUtils.getDeptId();
+        SysDept sysDept = deptMapper.selectDeptById(deptId);
         dept.setDeptId(sysDept.getDeptId());
 //        List<Long> longList = Convert.toList(Long.class, StrUtil.split(sysDept.getAncestors(), ','));
 //        longList.add(sysDept.getDeptId());
@@ -316,6 +319,25 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
                 .in(SysDept::getDeptId, ids));
     }
 
+    /**
+     * @param sysDept
+     */
+    @Override
+    public void updateDeptPointList(SysDept sysDept) {
+        sysDeptMapper.updateDept(sysDept);
+    }
+
+    /**
+     * @param deptId
+     * @return
+     */
+    @Override
+    public String getPointList(Long deptId) {
+
+        String PointList = sysDeptMapper.selectPointList(deptId);
+        return PointList;
+    }
+
     /**
      * 递归列表
      */

+ 13 - 5
leromro-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<sql id="selectDeptVo">
         select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time ,
-        d.area_type ,d.province_code ,d.province_name ,d.city_code ,d.city_name ,d.district_code ,d.district_name ,d.point_list
+        d.area_type ,d.province_code ,d.province_name ,d.city_code ,d.city_name ,d.district_code ,d.district_name ,d.point_list ,d.distribution_ratio
         from sys_dept d
     </sql>
     
@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
-			   d.area_type ,d.province_code ,d.province_name ,d.city_code ,d.city_name ,d.district_code ,d.district_name ,
+			   d.area_type ,d.province_code ,d.province_name ,d.city_code ,d.city_name ,d.district_code ,d.district_name ,d.distribution_ratio ,
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
 		from sys_dept d
 		where d.dept_id = #{deptId}
@@ -96,8 +96,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getAllOrgList" resultType="com.leromro.common.core.domain.entity.SysDept">
 		select * from sys_dept where del_flag = '0' and area_type = 3
 	</select>
+	<select id="getAlldept" resultType="com.leromro.common.core.domain.entity.SysDept">
+		select * from sys_dept where del_flag = '0'
+	</select>
+	<select id="selectPointList" resultType="java.lang.String" parameterType="java.lang.Long">
+		select point_list from sys_dept where dept_id = #{deptId}
+	</select>
 
-    <insert id="insertDept" parameterType="SysDept">
+	<insert id="insertDept" parameterType="SysDept">
         insert into sys_dept(
         <if test="deptId != null and deptId != 0">dept_id,</if>
         <if test="parentId != null and parentId != 0">parent_id,</if>
@@ -109,8 +115,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="email != null and email != ''">email,</if>
         <if test="status != null">status,</if>
         <if test="createBy != null and createBy != ''">create_by,</if>
-        <if test="pointList != null and pointList != ''">point_list,</if>
         <if test="areaType != null and areaType != ''">area_type,</if>
+
+		<if test="pointList != null and pointList != ''">point_list,</if>
         <if test="provinceCode != null and provinceCode != ''">province_code,</if>
         <if test="provinceName != null and provinceName != ''">province_name,</if>
         <if test="cityCode != null and cityCode != ''">city_code,</if>
@@ -129,8 +136,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="email != null and email != ''">#{email},</if>
         <if test="status != null">#{status},</if>
         <if test="createBy != null and createBy != ''">#{createBy},</if>
-		<if test="pointList != null and pointList != ''">#{pointList},</if>
         <if test="areaType != null and areaType != ''">#{areaType},</if>
+
+		<if test="pointList != null and pointList != ''">#{pointList},</if>
         <if test="provinceCode != null and provinceCode != ''">#{provinceCode},</if>
         <if test="provinceName != null and provinceName != ''">#{provinceName},</if>
         <if test="cityCode != null and cityCode != ''">#{cityCode},</if>