单位绑定人员统计
This commit is contained in:
parent
631ef0aa46
commit
ac4dd93a16
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
|
|
@ -44,6 +45,19 @@ public class BmUnitPersonController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计往来单位人员
|
||||
*/
|
||||
@ApiOperation(value = "统计往来单位人员")
|
||||
@RequiresPermissions("basic:person:list")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.QUERY, logType = 1,module = "仓储管理->统计往来单位人员")
|
||||
@GetMapping("/{unitId}")
|
||||
public AjaxResult countBmUnitPersonByUnitId(@PathVariable Long unitId)
|
||||
{
|
||||
int result = bmUnitPersonService.countBmUnitPersonByUnitId(unitId);
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定往来单位人员列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -71,5 +71,5 @@ public interface BmUnitMapper
|
|||
* @param unitId
|
||||
* @return
|
||||
*/
|
||||
Integer selectBmUnitPersonByUnitId(Long unitId);
|
||||
Integer countBmUnitPersonByUnitId(Long unitId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,4 +37,6 @@ public interface IBmUnitPersonService
|
|||
* @return
|
||||
*/
|
||||
List<BmUnit> selectBmUnitList(BmUnitPerson bmUnitPerson);
|
||||
|
||||
int countBmUnitPersonByUnitId(Long unitId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
|||
}
|
||||
if (item.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
item.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(item.getUnitId()) > 0 ? 1 : 0);
|
||||
item.setIsBind(bmUnitMapper.countBmUnitPersonByUnitId(item.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
extracted(item);
|
||||
});
|
||||
|
|
@ -124,6 +124,11 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
|||
return bmUnitList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countBmUnitPersonByUnitId(Long unitId) {
|
||||
return bmUnitMapper.countBmUnitPersonByUnitId(unitId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取
|
||||
* @param unit
|
||||
|
|
@ -132,7 +137,7 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
|||
Map<String, String> labelMap = remoteConfig.getDictValue("bm_unit_type");
|
||||
if (unit.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
unit.setIsBind(bmUnitMapper.countBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
if (unit.getTypeId() != null) {
|
||||
unit.setTypeName(labelMap.get(unit.getTypeId().toString()) == null ? "" : labelMap.get(unit.getTypeId().toString()));
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
Map<String, String> labelMap = remoteConfig.getDictValue("bm_unit_type");
|
||||
if (unit.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
unit.setIsBind(bmUnitMapper.countBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
if (unit.getTypeId() != null) {
|
||||
unit.setTypeName(labelMap.get(unit.getTypeId().toString()) == null ? "" : labelMap.get(unit.getTypeId().toString()));
|
||||
|
|
@ -189,7 +189,7 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
public AjaxResult deleteBmUnitByUnitId(Long unitId)
|
||||
{
|
||||
//先查看往来单位是否被绑定,绑定则不能删除
|
||||
if (bmUnitMapper.selectBmUnitPersonByUnitId(unitId) > 0) {
|
||||
if (bmUnitMapper.countBmUnitPersonByUnitId(unitId) > 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该单位还绑定相关人员,无法删除");
|
||||
}
|
||||
int result = bmUnitMapper.deleteBmUnitByUnitId(unitId);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select unit_id as unitId, unit_name as unitName from bm_unit where del_flag = 0 and unit_name = #{unitName}
|
||||
</select>
|
||||
|
||||
<select id="selectBmUnitPersonByUnitId" resultType="java.lang.Integer">
|
||||
<select id="countBmUnitPersonByUnitId" resultType="java.lang.Integer">
|
||||
select count(1) from bm_unit_person where unit_id = #{unitId}
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue