机构删除修改
This commit is contained in:
parent
df838d2b3b
commit
ff2adb4396
@ -90,7 +90,7 @@ public class AgencyController extends BaseController {
|
||||
@Log(title = "机构信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(agencyService.deleteAgencyByIds(ids));
|
||||
return agencyService.deleteAgencyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -22,6 +22,14 @@ public interface AgencyMapper {
|
||||
*/
|
||||
Agency selectAgencyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询下级机构信息
|
||||
*
|
||||
* @param id 机构信息主键
|
||||
* @return 机构信息
|
||||
*/
|
||||
List<Agency> selectSubordinateAgencyById(Long[] id);
|
||||
|
||||
/**
|
||||
* 查询机构信息
|
||||
*
|
||||
|
||||
@ -53,7 +53,7 @@ public interface IAgencyService {
|
||||
* @param ids 需要删除的机构信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteAgencyByIds(Long[] ids);
|
||||
AjaxResult deleteAgencyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除机构信息信息
|
||||
|
||||
@ -73,6 +73,7 @@ public class AgencyServiceImpl implements IAgencyService {
|
||||
@Override
|
||||
public int insertAgency(Agency agency) {
|
||||
agency.setCreateTime(DateUtils.getNowDate());
|
||||
agency.setCreateBy(SecurityUtils.getUsername());
|
||||
return agencyMapper.insertAgency(agency);
|
||||
}
|
||||
|
||||
@ -85,6 +86,7 @@ public class AgencyServiceImpl implements IAgencyService {
|
||||
@Override
|
||||
public int updateAgency(Agency agency) {
|
||||
agency.setUpdateTime(DateUtils.getNowDate());
|
||||
agency.setUpdateBy(SecurityUtils.getUsername());
|
||||
return agencyMapper.updateAgency(agency);
|
||||
}
|
||||
|
||||
@ -95,8 +97,12 @@ public class AgencyServiceImpl implements IAgencyService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAgencyByIds(Long[] ids) {
|
||||
return agencyMapper.deleteAgencyByIds(ids);
|
||||
public AjaxResult deleteAgencyByIds(Long[] ids) {
|
||||
int size = agencyMapper.selectSubordinateAgencyById(ids).size();
|
||||
if (size > 0) {
|
||||
return AjaxResult.error("该机构存在下级机构,请先删除其下级机构!");
|
||||
}
|
||||
return AjaxResult.success(agencyMapper.deleteAgencyByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -122,6 +122,14 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectSubordinateAgencyById" resultType="com.xinelu.manage.domain.agency.Agency">
|
||||
<include refid="selectAgencyVo"/>
|
||||
where parent_id =
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectAgencyVOById" resultType="com.xinelu.manage.vo.agency.AgencyVO">
|
||||
select id,
|
||||
ay.parent_id,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user