配置文件
This commit is contained in:
parent
162df48666
commit
f54b66092c
|
|
@ -43,7 +43,7 @@ public class SelectController extends BaseController {
|
|||
}
|
||||
@ApiOperation(value = "字典下拉选")
|
||||
@PostMapping("getDictList")
|
||||
public AjaxResult getDictList(Integer code){
|
||||
public AjaxResult getDictList(String code){
|
||||
return service.getDictList(code);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,5 +51,5 @@ public interface ISelectMapper {
|
|||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<TreeNode> getDictList(@Param("code") Integer code);
|
||||
List<TreeNode> getDictList(@Param("code") String code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,5 +46,5 @@ public interface ISelectService {
|
|||
* @param code
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getDictList(Integer code);
|
||||
AjaxResult getDictList(String code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.securitycontrol.entity.system.vo.SelectVo;
|
|||
import com.securitycontrol.entity.system.vo.TreeNode;
|
||||
import com.securitycontrol.system.base.mapper.ISelectMapper;
|
||||
import com.securitycontrol.system.base.service.ISelectService;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -80,9 +81,10 @@ public class SelectServiceImpl implements ISelectService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getDictList(Integer code) {
|
||||
public AjaxResult getDictList(String code) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
try {
|
||||
|
||||
List<TreeNode> list = mapper.getDictList(code);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
|
|
|
|||
|
|
@ -61,4 +61,10 @@ public interface DictMapper {
|
|||
* @return
|
||||
*/
|
||||
DictVo getDetails(String id);
|
||||
|
||||
/**
|
||||
* 修改子节点编码
|
||||
* @param dto
|
||||
*/
|
||||
void updateChildCode(DictVo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,14 @@ public class DictServiceImpl implements DictService {
|
|||
@Override
|
||||
public Result<String> updateDict(DictVo dto) {
|
||||
try{
|
||||
//查询数据
|
||||
DictVo vo=mapper.getDetails(dto.getDictId().toString());
|
||||
if(vo==null){
|
||||
return Result.fail("数据不存在");
|
||||
}
|
||||
if(vo.getDictCode().equals(dto.getPidCode())){
|
||||
return Result.fail("父节点不能是自己");
|
||||
}
|
||||
if(dto.getPidCode()==null){
|
||||
dto.setPidCode(0);
|
||||
}
|
||||
|
|
@ -92,6 +100,8 @@ public class DictServiceImpl implements DictService {
|
|||
return res;
|
||||
}
|
||||
int num=mapper.updateDict(dto);
|
||||
vo.setPidCode(dto.getDictCode());
|
||||
mapper.updateChildCode(vo);
|
||||
if(num>0){
|
||||
return Result.ok("修改成功");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@ import com.securitycontrol.entity.system.dto.OrgDto;
|
|||
import com.securitycontrol.entity.system.vo.OrgVo;
|
||||
import com.securitycontrol.system.mapper.OrgMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Service;
|
||||
import sun.plugin.util.UIUtil;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -104,8 +102,15 @@ public class OrgServiceImpl implements OrgService{
|
|||
@Override
|
||||
public Result<String> updateOrg(OrgVo dto) {
|
||||
try{
|
||||
OrgVo orgVo=mapper.getDetails(dto.getOrgId());
|
||||
if(orgVo==null){
|
||||
return Result.fail("数据不存在");
|
||||
}
|
||||
if(orgVo.getOrgId().equals(dto.getPId())){
|
||||
return Result.fail("父节点不能是自己");
|
||||
}
|
||||
if(StringHelper.isEmpty(dto.getOrgId())){
|
||||
return Result.ok("主键不能为空");
|
||||
return Result.fail("主键不能为空");
|
||||
}
|
||||
if(StringHelper.isEmpty(dto.getPId())){
|
||||
dto.setPId("0");
|
||||
|
|
|
|||
|
|
@ -61,13 +61,19 @@
|
|||
<!--修改-->
|
||||
<update id="updateDict">
|
||||
update sys_dict
|
||||
set dict_code=#{dictCode},dict_name=#{dictName},dict_sort=#{dictValue},remarks=#{remarks}
|
||||
set dict_code=#{dictCode},dict_name=#{dictName},dict_sort=#{dictValue},remarks=#{remarks},p_code=#{pidCode}
|
||||
where dict_id=#{dictId};
|
||||
</update>
|
||||
|
||||
<update id="updateChildCode">
|
||||
update sys_dict
|
||||
set p_code=#{pidCode}
|
||||
where p_code=#{dictCode};
|
||||
</update>
|
||||
<!--删除-->
|
||||
<delete id="delDict">
|
||||
update sys_dict
|
||||
set p_code=1
|
||||
set del_flag=1
|
||||
where dict_id=#{dictId};
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue