放弃管理员自己的areaId,而使用角色的areaId
This commit is contained in:
parent
96eb0bb2bd
commit
08284877ad
|
|
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.system.domain.SysAllocArea;
|
||||
import com.bonus.system.service.ISysAllocAreaService;
|
||||
import com.bonus.system.domain.AllocArea;
|
||||
import com.bonus.system.service.IAllocAreaService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
|
|
@ -29,10 +29,10 @@ import com.bonus.common.core.web.page.TableDataInfo;
|
|||
*/
|
||||
@Api(tags = "区域接口")
|
||||
@RestController
|
||||
@RequestMapping("/sys_alloc_area")
|
||||
public class SysAllocAreaController extends BaseController {
|
||||
@RequestMapping("/alloc_area")
|
||||
public class AllocAreaController extends BaseController {
|
||||
@Autowired
|
||||
private ISysAllocAreaService sysAllocAreaService;
|
||||
private IAllocAreaService sysAllocAreaService;
|
||||
|
||||
/**
|
||||
* 查询区域列表
|
||||
|
|
@ -40,9 +40,9 @@ public class SysAllocAreaController extends BaseController {
|
|||
@ApiOperation(value = "查询区域列表")
|
||||
@RequiresPermissions("system:area:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysAllocArea sysAllocArea) {
|
||||
public TableDataInfo list(AllocArea sysAllocArea) {
|
||||
startPage();
|
||||
List<SysAllocArea> list = sysAllocAreaService.selectSysAllocAreaList(sysAllocArea);
|
||||
List<AllocArea> list = sysAllocAreaService.selectAllocAreaList(sysAllocArea);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -53,9 +53,9 @@ public class SysAllocAreaController extends BaseController {
|
|||
@RequiresPermissions("system:area:export")
|
||||
@SysLog(title = "区域", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出区域")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysAllocArea sysAllocArea) {
|
||||
List<SysAllocArea> list = sysAllocAreaService.selectSysAllocAreaList(sysAllocArea);
|
||||
ExcelUtil<SysAllocArea> util = new ExcelUtil<SysAllocArea>(SysAllocArea.class);
|
||||
public void export(HttpServletResponse response, AllocArea sysAllocArea) {
|
||||
List<AllocArea> list = sysAllocAreaService.selectAllocAreaList(sysAllocArea);
|
||||
ExcelUtil<AllocArea> util = new ExcelUtil<AllocArea>(AllocArea.class);
|
||||
util.exportExcel(response, list, "区域数据");
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public class SysAllocAreaController extends BaseController {
|
|||
@RequiresPermissions("system:area:query")
|
||||
@GetMapping(value = "/{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")
|
||||
@SysLog(title = "区域", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增区域")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysAllocArea sysAllocArea) {
|
||||
public AjaxResult add(@RequestBody AllocArea sysAllocArea) {
|
||||
try {
|
||||
return toAjax(sysAllocAreaService.insertSysAllocArea(sysAllocArea));
|
||||
return toAjax(sysAllocAreaService.insertAllocArea(sysAllocArea));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
}
|
||||
|
|
@ -91,9 +91,9 @@ public class SysAllocAreaController extends BaseController {
|
|||
@RequiresPermissions("system:area:edit")
|
||||
@SysLog(title = "区域", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改区域")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody SysAllocArea sysAllocArea) {
|
||||
public AjaxResult edit(@RequestBody AllocArea sysAllocArea) {
|
||||
try {
|
||||
return toAjax(sysAllocAreaService.updateSysAllocArea(sysAllocArea));
|
||||
return toAjax(sysAllocAreaService.updateAllocArea(sysAllocArea));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
}
|
||||
|
|
@ -107,6 +107,6 @@ public class SysAllocAreaController extends BaseController {
|
|||
@SysLog(title = "区域", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除区域")
|
||||
@PostMapping("/del/{areaIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] areaIds) {
|
||||
return toAjax(sysAllocAreaService.deleteSysAllocAreaByAreaIds(areaIds));
|
||||
return toAjax(sysAllocAreaService.deleteAllocAreaByAreaIds(areaIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
|
||||
@Data
|
||||
@ToString
|
||||
public class SysAllocArea extends BaseEntity {
|
||||
public class AllocArea extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 区域id */
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.bonus.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.system.domain.SysAllocArea;
|
||||
import com.bonus.system.domain.AllocArea;
|
||||
|
||||
/**
|
||||
* 区域Mapper接口
|
||||
|
|
@ -9,14 +9,14 @@ import com.bonus.system.domain.SysAllocArea;
|
|||
* @author xsheng
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
public interface SysAllocAreaMapper {
|
||||
public interface AllocAreaMapper {
|
||||
/**
|
||||
* 查询区域
|
||||
*
|
||||
* @param areaId 区域主键
|
||||
* @return 区域
|
||||
*/
|
||||
public SysAllocArea selectSysAllocAreaByAreaId(Long areaId);
|
||||
public AllocArea selectAllocAreaByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 查询区域列表
|
||||
|
|
@ -24,7 +24,7 @@ public interface SysAllocAreaMapper {
|
|||
* @param sysAllocArea 区域
|
||||
* @return 区域集合
|
||||
*/
|
||||
public List<SysAllocArea> selectSysAllocAreaList(SysAllocArea sysAllocArea);
|
||||
public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea);
|
||||
|
||||
/**
|
||||
* 新增区域
|
||||
|
|
@ -32,7 +32,7 @@ public interface SysAllocAreaMapper {
|
|||
* @param sysAllocArea 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysAllocArea(SysAllocArea sysAllocArea);
|
||||
public int insertAllocArea(AllocArea sysAllocArea);
|
||||
|
||||
/**
|
||||
* 修改区域
|
||||
|
|
@ -40,7 +40,7 @@ public interface SysAllocAreaMapper {
|
|||
* @param sysAllocArea 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysAllocArea(SysAllocArea sysAllocArea);
|
||||
public int updateAllocArea(AllocArea sysAllocArea);
|
||||
|
||||
/**
|
||||
* 删除区域
|
||||
|
|
@ -48,7 +48,7 @@ public interface SysAllocAreaMapper {
|
|||
* @param areaId 区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAllocAreaByAreaId(Long areaId);
|
||||
public int deleteAllocAreaByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 批量删除区域
|
||||
|
|
@ -56,5 +56,5 @@ public interface SysAllocAreaMapper {
|
|||
* @param areaIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAllocAreaByAreaIds(Long[] areaIds);
|
||||
public int deleteAllocAreaByAreaIds(Long[] areaIds);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.bonus.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.system.domain.SysAllocArea;
|
||||
import com.bonus.system.domain.AllocArea;
|
||||
|
||||
/**
|
||||
* 区域Service接口
|
||||
|
|
@ -9,14 +9,14 @@ import com.bonus.system.domain.SysAllocArea;
|
|||
* @author xsheng
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
public interface ISysAllocAreaService {
|
||||
public interface IAllocAreaService {
|
||||
/**
|
||||
* 查询区域
|
||||
*
|
||||
* @param areaId 区域主键
|
||||
* @return 区域
|
||||
*/
|
||||
public SysAllocArea selectSysAllocAreaByAreaId(Long areaId);
|
||||
public AllocArea selectAllocAreaByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 查询区域列表
|
||||
|
|
@ -24,7 +24,7 @@ public interface ISysAllocAreaService {
|
|||
* @param sysAllocArea 区域
|
||||
* @return 区域集合
|
||||
*/
|
||||
public List<SysAllocArea> selectSysAllocAreaList(SysAllocArea sysAllocArea);
|
||||
public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea);
|
||||
|
||||
/**
|
||||
* 新增区域
|
||||
|
|
@ -32,7 +32,7 @@ public interface ISysAllocAreaService {
|
|||
* @param sysAllocArea 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysAllocArea(SysAllocArea sysAllocArea);
|
||||
public int insertAllocArea(AllocArea sysAllocArea);
|
||||
|
||||
/**
|
||||
* 修改区域
|
||||
|
|
@ -40,7 +40,7 @@ public interface ISysAllocAreaService {
|
|||
* @param sysAllocArea 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysAllocArea(SysAllocArea sysAllocArea);
|
||||
public int updateAllocArea(AllocArea sysAllocArea);
|
||||
|
||||
/**
|
||||
* 批量删除区域
|
||||
|
|
@ -48,7 +48,7 @@ public interface ISysAllocAreaService {
|
|||
* @param areaIds 需要删除的区域主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAllocAreaByAreaIds(Long[] areaIds);
|
||||
public int deleteAllocAreaByAreaIds(Long[] areaIds);
|
||||
|
||||
/**
|
||||
* 删除区域信息
|
||||
|
|
@ -56,5 +56,5 @@ public interface ISysAllocAreaService {
|
|||
* @param areaId 区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAllocAreaByAreaId(Long areaId);
|
||||
public int deleteAllocAreaByAreaId(Long areaId);
|
||||
}
|
||||
|
|
@ -6,9 +6,9 @@ import com.bonus.common.core.utils.DateUtils;
|
|||
import com.bonus.common.core.utils.id.Id;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.system.mapper.SysAllocAreaMapper;
|
||||
import com.bonus.system.domain.SysAllocArea;
|
||||
import com.bonus.system.service.ISysAllocAreaService;
|
||||
import com.bonus.system.mapper.AllocAreaMapper;
|
||||
import com.bonus.system.domain.AllocArea;
|
||||
import com.bonus.system.service.IAllocAreaService;
|
||||
|
||||
/**
|
||||
* 区域Service业务层处理
|
||||
|
|
@ -17,9 +17,9 @@ import com.bonus.system.service.ISysAllocAreaService;
|
|||
* @date 2025-02-18
|
||||
*/
|
||||
@Service
|
||||
public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
|
||||
public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||
@Autowired
|
||||
private SysAllocAreaMapper sysAllocAreaMapper;
|
||||
private AllocAreaMapper sysAllocAreaMapper;
|
||||
|
||||
/**
|
||||
* 查询区域
|
||||
|
|
@ -28,8 +28,8 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
|
|||
* @return 区域
|
||||
*/
|
||||
@Override
|
||||
public SysAllocArea selectSysAllocAreaByAreaId(Long areaId) {
|
||||
return sysAllocAreaMapper.selectSysAllocAreaByAreaId(areaId);
|
||||
public AllocArea selectAllocAreaByAreaId(Long areaId) {
|
||||
return sysAllocAreaMapper.selectAllocAreaByAreaId(areaId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,8 +39,8 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
|
|||
* @return 区域
|
||||
*/
|
||||
@Override
|
||||
public List<SysAllocArea> selectSysAllocAreaList(SysAllocArea sysAllocArea) {
|
||||
return sysAllocAreaMapper.selectSysAllocAreaList(sysAllocArea);
|
||||
public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea) {
|
||||
return sysAllocAreaMapper.selectAllocAreaList(sysAllocArea);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -50,11 +50,11 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysAllocArea(SysAllocArea sysAllocArea) {
|
||||
public int insertAllocArea(AllocArea sysAllocArea) {
|
||||
sysAllocArea.setCreateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
sysAllocArea.setAreaId(Id.next());
|
||||
return sysAllocAreaMapper.insertSysAllocArea(sysAllocArea);
|
||||
return sysAllocAreaMapper.insertAllocArea(sysAllocArea);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("新增区域错误" + e.getMessage());
|
||||
}
|
||||
|
|
@ -67,10 +67,10 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysAllocArea(SysAllocArea sysAllocArea) {
|
||||
public int updateAllocArea(AllocArea sysAllocArea) {
|
||||
sysAllocArea.setUpdateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
return sysAllocAreaMapper.updateSysAllocArea(sysAllocArea);
|
||||
return sysAllocAreaMapper.updateAllocArea(sysAllocArea);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
|
|
@ -83,8 +83,8 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysAllocAreaByAreaIds(Long[] areaIds) {
|
||||
return sysAllocAreaMapper.deleteSysAllocAreaByAreaIds(areaIds);
|
||||
public int deleteAllocAreaByAreaIds(Long[] areaIds) {
|
||||
return sysAllocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,7 +94,7 @@ public class SysAllocAreaServiceImpl implements ISysAllocAreaService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysAllocAreaByAreaId(Long areaId) {
|
||||
return sysAllocAreaMapper.deleteSysAllocAreaByAreaId(areaId);
|
||||
public int deleteAllocAreaByAreaId(Long areaId) {
|
||||
return sysAllocAreaMapper.deleteAllocAreaByAreaId(areaId);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.system.mapper.SysAllocAreaMapper">
|
||||
<resultMap type="com.bonus.system.domain.SysAllocArea" id="SysAllocAreaResult">
|
||||
<mapper namespace="com.bonus.system.mapper.AllocAreaMapper">
|
||||
<resultMap type="com.bonus.system.domain.AllocArea" id="AllocAreaResult">
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="ancestors" column="ancestors" />
|
||||
|
|
@ -17,12 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysAllocAreaVo">
|
||||
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
|
||||
<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 alloc_area
|
||||
</sql>
|
||||
|
||||
<select id="selectSysAllocAreaList" parameterType="com.bonus.system.domain.SysAllocArea" resultMap="SysAllocAreaResult">
|
||||
<include refid="selectSysAllocAreaVo"/>
|
||||
<select id="selectAllocAreaList" parameterType="com.bonus.system.domain.AllocArea" resultMap="AllocAreaResult">
|
||||
<include refid="selectAllocAreaVo"/>
|
||||
<where>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
|
||||
|
|
@ -32,13 +32,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysAllocAreaByAreaId" parameterType="Long" resultMap="SysAllocAreaResult">
|
||||
<include refid="selectSysAllocAreaVo"/>
|
||||
<select id="selectAllocAreaByAreaId" parameterType="Long" resultMap="AllocAreaResult">
|
||||
<include refid="selectAllocAreaVo"/>
|
||||
where area_id = #{areaId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysAllocArea" parameterType="com.bonus.system.domain.SysAllocArea">
|
||||
insert into sys_alloc_area
|
||||
<insert id="insertAllocArea" parameterType="com.bonus.system.domain.AllocArea">
|
||||
insert into alloc_area
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
|
|
@ -63,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysAllocArea" parameterType="com.bonus.system.domain.SysAllocArea">
|
||||
update sys_alloc_area
|
||||
<update id="updateAllocArea" parameterType="com.bonus.system.domain.AllocArea">
|
||||
update alloc_area
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parentId != null">parent_id = #{parentId},</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}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysAllocAreaByAreaId" parameterType="Long">
|
||||
delete from sys_alloc_area where area_id = #{areaId}
|
||||
<delete id="deleteAllocAreaByAreaId" parameterType="Long">
|
||||
delete from alloc_area where area_id = #{areaId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysAllocAreaByAreaIds" parameterType="String">
|
||||
delete from sys_alloc_area where area_id in
|
||||
<delete id="deleteAllocAreaByAreaIds" parameterType="String">
|
||||
delete from alloc_area where area_id in
|
||||
<foreach item="areaId" collection="array" open="(" separator="," close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
Loading…
Reference in New Issue