放弃管理员自己的areaId,而使用角色的areaId

This commit is contained in:
sxu 2025-02-19 16:14:46 +08:00
parent 96eb0bb2bd
commit 08284877ad
6 changed files with 66 additions and 66 deletions

View File

@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.system.domain.SysAllocArea; import com.bonus.system.domain.AllocArea;
import com.bonus.system.service.ISysAllocAreaService; import com.bonus.system.service.IAllocAreaService;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.utils.poi.ExcelUtil;
@ -29,10 +29,10 @@ import com.bonus.common.core.web.page.TableDataInfo;
*/ */
@Api(tags = "区域接口") @Api(tags = "区域接口")
@RestController @RestController
@RequestMapping("/sys_alloc_area") @RequestMapping("/alloc_area")
public class SysAllocAreaController extends BaseController { public class AllocAreaController extends BaseController {
@Autowired @Autowired
private ISysAllocAreaService sysAllocAreaService; private IAllocAreaService sysAllocAreaService;
/** /**
* 查询区域列表 * 查询区域列表
@ -40,9 +40,9 @@ public class SysAllocAreaController extends BaseController {
@ApiOperation(value = "查询区域列表") @ApiOperation(value = "查询区域列表")
@RequiresPermissions("system:area:list") @RequiresPermissions("system:area:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysAllocArea sysAllocArea) { public TableDataInfo list(AllocArea sysAllocArea) {
startPage(); startPage();
List<SysAllocArea> list = sysAllocAreaService.selectSysAllocAreaList(sysAllocArea); List<AllocArea> list = sysAllocAreaService.selectAllocAreaList(sysAllocArea);
return getDataTable(list); return getDataTable(list);
} }
@ -53,9 +53,9 @@ public class SysAllocAreaController extends BaseController {
@RequiresPermissions("system:area:export") @RequiresPermissions("system:area:export")
@SysLog(title = "区域", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出区域") @SysLog(title = "区域", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出区域")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysAllocArea sysAllocArea) { public void export(HttpServletResponse response, AllocArea sysAllocArea) {
List<SysAllocArea> list = sysAllocAreaService.selectSysAllocAreaList(sysAllocArea); List<AllocArea> list = sysAllocAreaService.selectAllocAreaList(sysAllocArea);
ExcelUtil<SysAllocArea> util = new ExcelUtil<SysAllocArea>(SysAllocArea.class); ExcelUtil<AllocArea> util = new ExcelUtil<AllocArea>(AllocArea.class);
util.exportExcel(response, list, "区域数据"); util.exportExcel(response, list, "区域数据");
} }
@ -66,7 +66,7 @@ public class SysAllocAreaController extends BaseController {
@RequiresPermissions("system:area:query") @RequiresPermissions("system:area:query")
@GetMapping(value = "/{areaId}") @GetMapping(value = "/{areaId}")
public AjaxResult getInfo(@PathVariable("areaId") Long areaId) { public AjaxResult getInfo(@PathVariable("areaId") Long areaId) {
return success(sysAllocAreaService.selectSysAllocAreaByAreaId(areaId)); return success(sysAllocAreaService.selectAllocAreaByAreaId(areaId));
} }
/** /**
@ -76,9 +76,9 @@ public class SysAllocAreaController extends BaseController {
@RequiresPermissions("system:area:add") @RequiresPermissions("system:area:add")
@SysLog(title = "区域", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增区域") @SysLog(title = "区域", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增区域")
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SysAllocArea sysAllocArea) { public AjaxResult add(@RequestBody AllocArea sysAllocArea) {
try { try {
return toAjax(sysAllocAreaService.insertSysAllocArea(sysAllocArea)); return toAjax(sysAllocAreaService.insertAllocArea(sysAllocArea));
} catch (Exception e) { } catch (Exception e) {
return error("系统错误, " + e.getMessage()); return error("系统错误, " + e.getMessage());
} }
@ -91,9 +91,9 @@ public class SysAllocAreaController extends BaseController {
@RequiresPermissions("system:area:edit") @RequiresPermissions("system:area:edit")
@SysLog(title = "区域", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改区域") @SysLog(title = "区域", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改区域")
@PostMapping("/edit") @PostMapping("/edit")
public AjaxResult edit(@RequestBody SysAllocArea sysAllocArea) { public AjaxResult edit(@RequestBody AllocArea sysAllocArea) {
try { try {
return toAjax(sysAllocAreaService.updateSysAllocArea(sysAllocArea)); return toAjax(sysAllocAreaService.updateAllocArea(sysAllocArea));
} catch (Exception e) { } catch (Exception e) {
return error("系统错误, " + e.getMessage()); return error("系统错误, " + e.getMessage());
} }
@ -107,6 +107,6 @@ public class SysAllocAreaController extends BaseController {
@SysLog(title = "区域", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除区域") @SysLog(title = "区域", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除区域")
@PostMapping("/del/{areaIds}") @PostMapping("/del/{areaIds}")
public AjaxResult remove(@PathVariable Long[] areaIds) { public AjaxResult remove(@PathVariable Long[] areaIds) {
return toAjax(sysAllocAreaService.deleteSysAllocAreaByAreaIds(areaIds)); return toAjax(sysAllocAreaService.deleteAllocAreaByAreaIds(areaIds));
} }
} }

View File

@ -16,7 +16,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
@Data @Data
@ToString @ToString
public class SysAllocArea extends BaseEntity { public class AllocArea extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 区域id */ /** 区域id */

View File

@ -1,7 +1,7 @@
package com.bonus.system.mapper; package com.bonus.system.mapper;
import java.util.List; import java.util.List;
import com.bonus.system.domain.SysAllocArea; import com.bonus.system.domain.AllocArea;
/** /**
* 区域Mapper接口 * 区域Mapper接口
@ -9,14 +9,14 @@ import com.bonus.system.domain.SysAllocArea;
* @author xsheng * @author xsheng
* @date 2025-02-18 * @date 2025-02-18
*/ */
public interface SysAllocAreaMapper { public interface AllocAreaMapper {
/** /**
* 查询区域 * 查询区域
* *
* @param areaId 区域主键 * @param areaId 区域主键
* @return 区域 * @return 区域
*/ */
public SysAllocArea selectSysAllocAreaByAreaId(Long areaId); public AllocArea selectAllocAreaByAreaId(Long areaId);
/** /**
* 查询区域列表 * 查询区域列表
@ -24,7 +24,7 @@ public interface SysAllocAreaMapper {
* @param sysAllocArea 区域 * @param sysAllocArea 区域
* @return 区域集合 * @return 区域集合
*/ */
public List<SysAllocArea> selectSysAllocAreaList(SysAllocArea sysAllocArea); public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea);
/** /**
* 新增区域 * 新增区域
@ -32,7 +32,7 @@ public interface SysAllocAreaMapper {
* @param sysAllocArea 区域 * @param sysAllocArea 区域
* @return 结果 * @return 结果
*/ */
public int insertSysAllocArea(SysAllocArea sysAllocArea); public int insertAllocArea(AllocArea sysAllocArea);
/** /**
* 修改区域 * 修改区域
@ -40,7 +40,7 @@ public interface SysAllocAreaMapper {
* @param sysAllocArea 区域 * @param sysAllocArea 区域
* @return 结果 * @return 结果
*/ */
public int updateSysAllocArea(SysAllocArea sysAllocArea); public int updateAllocArea(AllocArea sysAllocArea);
/** /**
* 删除区域 * 删除区域
@ -48,7 +48,7 @@ public interface SysAllocAreaMapper {
* @param areaId 区域主键 * @param areaId 区域主键
* @return 结果 * @return 结果
*/ */
public int deleteSysAllocAreaByAreaId(Long areaId); public int deleteAllocAreaByAreaId(Long areaId);
/** /**
* 批量删除区域 * 批量删除区域
@ -56,5 +56,5 @@ public interface SysAllocAreaMapper {
* @param areaIds 需要删除的数据主键集合 * @param areaIds 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteSysAllocAreaByAreaIds(Long[] areaIds); public int deleteAllocAreaByAreaIds(Long[] areaIds);
} }

View File

@ -1,7 +1,7 @@
package com.bonus.system.service; package com.bonus.system.service;
import java.util.List; import java.util.List;
import com.bonus.system.domain.SysAllocArea; import com.bonus.system.domain.AllocArea;
/** /**
* 区域Service接口 * 区域Service接口
@ -9,14 +9,14 @@ import com.bonus.system.domain.SysAllocArea;
* @author xsheng * @author xsheng
* @date 2025-02-18 * @date 2025-02-18
*/ */
public interface ISysAllocAreaService { public interface IAllocAreaService {
/** /**
* 查询区域 * 查询区域
* *
* @param areaId 区域主键 * @param areaId 区域主键
* @return 区域 * @return 区域
*/ */
public SysAllocArea selectSysAllocAreaByAreaId(Long areaId); public AllocArea selectAllocAreaByAreaId(Long areaId);
/** /**
* 查询区域列表 * 查询区域列表
@ -24,7 +24,7 @@ public interface ISysAllocAreaService {
* @param sysAllocArea 区域 * @param sysAllocArea 区域
* @return 区域集合 * @return 区域集合
*/ */
public List<SysAllocArea> selectSysAllocAreaList(SysAllocArea sysAllocArea); public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea);
/** /**
* 新增区域 * 新增区域
@ -32,7 +32,7 @@ public interface ISysAllocAreaService {
* @param sysAllocArea 区域 * @param sysAllocArea 区域
* @return 结果 * @return 结果
*/ */
public int insertSysAllocArea(SysAllocArea sysAllocArea); public int insertAllocArea(AllocArea sysAllocArea);
/** /**
* 修改区域 * 修改区域
@ -40,7 +40,7 @@ public interface ISysAllocAreaService {
* @param sysAllocArea 区域 * @param sysAllocArea 区域
* @return 结果 * @return 结果
*/ */
public int updateSysAllocArea(SysAllocArea sysAllocArea); public int updateAllocArea(AllocArea sysAllocArea);
/** /**
* 批量删除区域 * 批量删除区域
@ -48,7 +48,7 @@ public interface ISysAllocAreaService {
* @param areaIds 需要删除的区域主键集合 * @param areaIds 需要删除的区域主键集合
* @return 结果 * @return 结果
*/ */
public int deleteSysAllocAreaByAreaIds(Long[] areaIds); public int deleteAllocAreaByAreaIds(Long[] areaIds);
/** /**
* 删除区域信息 * 删除区域信息
@ -56,5 +56,5 @@ public interface ISysAllocAreaService {
* @param areaId 区域主键 * @param areaId 区域主键
* @return 结果 * @return 结果
*/ */
public int deleteSysAllocAreaByAreaId(Long areaId); public int deleteAllocAreaByAreaId(Long areaId);
} }

View File

@ -6,9 +6,9 @@ import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.id.Id; import com.bonus.common.core.utils.id.Id;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.bonus.system.mapper.SysAllocAreaMapper; import com.bonus.system.mapper.AllocAreaMapper;
import com.bonus.system.domain.SysAllocArea; import com.bonus.system.domain.AllocArea;
import com.bonus.system.service.ISysAllocAreaService; import com.bonus.system.service.IAllocAreaService;
/** /**
* 区域Service业务层处理 * 区域Service业务层处理
@ -17,9 +17,9 @@ import com.bonus.system.service.ISysAllocAreaService;
* @date 2025-02-18 * @date 2025-02-18
*/ */
@Service @Service
public class SysAllocAreaServiceImpl implements ISysAllocAreaService { public class AllocAreaServiceImpl implements IAllocAreaService {
@Autowired @Autowired
private SysAllocAreaMapper sysAllocAreaMapper; private AllocAreaMapper sysAllocAreaMapper;
/** /**
* 查询区域 * 查询区域
@ -28,8 +28,8 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
* @return 区域 * @return 区域
*/ */
@Override @Override
public SysAllocArea selectSysAllocAreaByAreaId(Long areaId) { public AllocArea selectAllocAreaByAreaId(Long areaId) {
return sysAllocAreaMapper.selectSysAllocAreaByAreaId(areaId); return sysAllocAreaMapper.selectAllocAreaByAreaId(areaId);
} }
/** /**
@ -39,8 +39,8 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
* @return 区域 * @return 区域
*/ */
@Override @Override
public List<SysAllocArea> selectSysAllocAreaList(SysAllocArea sysAllocArea) { public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea) {
return sysAllocAreaMapper.selectSysAllocAreaList(sysAllocArea); return sysAllocAreaMapper.selectAllocAreaList(sysAllocArea);
} }
/** /**
@ -50,11 +50,11 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertSysAllocArea(SysAllocArea sysAllocArea) { public int insertAllocArea(AllocArea sysAllocArea) {
sysAllocArea.setCreateTime(DateUtils.getNowDate()); sysAllocArea.setCreateTime(DateUtils.getNowDate());
try { try {
sysAllocArea.setAreaId(Id.next()); sysAllocArea.setAreaId(Id.next());
return sysAllocAreaMapper.insertSysAllocArea(sysAllocArea); return sysAllocAreaMapper.insertAllocArea(sysAllocArea);
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("新增区域错误" + e.getMessage()); throw new ServiceException("新增区域错误" + e.getMessage());
} }
@ -67,10 +67,10 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateSysAllocArea(SysAllocArea sysAllocArea) { public int updateAllocArea(AllocArea sysAllocArea) {
sysAllocArea.setUpdateTime(DateUtils.getNowDate()); sysAllocArea.setUpdateTime(DateUtils.getNowDate());
try { try {
return sysAllocAreaMapper.updateSysAllocArea(sysAllocArea); return sysAllocAreaMapper.updateAllocArea(sysAllocArea);
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("错误信息描述"); throw new ServiceException("错误信息描述");
} }
@ -83,8 +83,8 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysAllocAreaByAreaIds(Long[] areaIds) { public int deleteAllocAreaByAreaIds(Long[] areaIds) {
return sysAllocAreaMapper.deleteSysAllocAreaByAreaIds(areaIds); return sysAllocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
} }
/** /**
@ -94,7 +94,7 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysAllocAreaByAreaId(Long areaId) { public int deleteAllocAreaByAreaId(Long areaId) {
return sysAllocAreaMapper.deleteSysAllocAreaByAreaId(areaId); return sysAllocAreaMapper.deleteAllocAreaByAreaId(areaId);
} }
} }

View File

@ -2,8 +2,8 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.mapper.SysAllocAreaMapper"> <mapper namespace="com.bonus.system.mapper.AllocAreaMapper">
<resultMap type="com.bonus.system.domain.SysAllocArea" id="SysAllocAreaResult"> <resultMap type="com.bonus.system.domain.AllocArea" id="AllocAreaResult">
<result property="areaId" column="area_id" /> <result property="areaId" column="area_id" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" /> <result property="ancestors" column="ancestors" />
@ -17,12 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
</resultMap> </resultMap>
<sql id="selectSysAllocAreaVo"> <sql id="selectAllocAreaVo">
select area_id, parent_id, ancestors, area_name, order_num, status, del_flag, create_by, create_time, update_by, update_time from sys_alloc_area select area_id, parent_id, ancestors, area_name, order_num, status, del_flag, create_by, create_time, update_by, update_time from alloc_area
</sql> </sql>
<select id="selectSysAllocAreaList" parameterType="com.bonus.system.domain.SysAllocArea" resultMap="SysAllocAreaResult"> <select id="selectAllocAreaList" parameterType="com.bonus.system.domain.AllocArea" resultMap="AllocAreaResult">
<include refid="selectSysAllocAreaVo"/> <include refid="selectAllocAreaVo"/>
<where> <where>
<if test="parentId != null "> and parent_id = #{parentId}</if> <if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if> <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
@ -32,13 +32,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectSysAllocAreaByAreaId" parameterType="Long" resultMap="SysAllocAreaResult"> <select id="selectAllocAreaByAreaId" parameterType="Long" resultMap="AllocAreaResult">
<include refid="selectSysAllocAreaVo"/> <include refid="selectAllocAreaVo"/>
where area_id = #{areaId} where area_id = #{areaId}
</select> </select>
<insert id="insertSysAllocArea" parameterType="com.bonus.system.domain.SysAllocArea"> <insert id="insertAllocArea" parameterType="com.bonus.system.domain.AllocArea">
insert into sys_alloc_area insert into alloc_area
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaId != null">area_id,</if> <if test="areaId != null">area_id,</if>
<if test="parentId != null">parent_id,</if> <if test="parentId != null">parent_id,</if>
@ -63,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
</insert> </insert>
<update id="updateSysAllocArea" parameterType="com.bonus.system.domain.SysAllocArea"> <update id="updateAllocArea" parameterType="com.bonus.system.domain.AllocArea">
update sys_alloc_area update alloc_area
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if> <if test="parentId != null">parent_id = #{parentId},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
@ -78,12 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where area_id = #{areaId} where area_id = #{areaId}
</update> </update>
<delete id="deleteSysAllocAreaByAreaId" parameterType="Long"> <delete id="deleteAllocAreaByAreaId" parameterType="Long">
delete from sys_alloc_area where area_id = #{areaId} delete from alloc_area where area_id = #{areaId}
</delete> </delete>
<delete id="deleteSysAllocAreaByAreaIds" parameterType="String"> <delete id="deleteAllocAreaByAreaIds" parameterType="String">
delete from sys_alloc_area where area_id in delete from alloc_area where area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")"> <foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId} #{areaId}
</foreach> </foreach>