area manage
This commit is contained in:
parent
08284877ad
commit
bc67ab7ac3
|
|
@ -19,6 +19,8 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
public class AllocArea extends BaseEntity {
|
public class AllocArea extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/** 区域id */
|
/** 区域id */
|
||||||
private Long areaId;
|
private Long areaId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import com.bonus.system.service.IAllocAreaService;
|
||||||
@Service
|
@Service
|
||||||
public class AllocAreaServiceImpl implements IAllocAreaService {
|
public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AllocAreaMapper sysAllocAreaMapper;
|
private AllocAreaMapper allocAreaMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询区域
|
* 查询区域
|
||||||
|
|
@ -29,7 +29,7 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AllocArea selectAllocAreaByAreaId(Long areaId) {
|
public AllocArea selectAllocAreaByAreaId(Long areaId) {
|
||||||
return sysAllocAreaMapper.selectAllocAreaByAreaId(areaId);
|
return allocAreaMapper.selectAllocAreaByAreaId(areaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,21 +40,30 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea) {
|
public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea) {
|
||||||
return sysAllocAreaMapper.selectAllocAreaList(sysAllocArea);
|
return allocAreaMapper.selectAllocAreaList(sysAllocArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增区域
|
* 新增区域
|
||||||
*
|
*
|
||||||
* @param sysAllocArea 区域
|
* @param allocArea 区域
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertAllocArea(AllocArea sysAllocArea) {
|
public int insertAllocArea(AllocArea allocArea) {
|
||||||
sysAllocArea.setCreateTime(DateUtils.getNowDate());
|
allocArea.setCreateTime(DateUtils.getNowDate());
|
||||||
try {
|
try {
|
||||||
sysAllocArea.setAreaId(Id.next());
|
//增加根公司的处理
|
||||||
return sysAllocAreaMapper.insertAllocArea(sysAllocArea);
|
if (allocArea.getParentId() == null) {
|
||||||
|
allocArea.setParentId(0L);
|
||||||
|
allocArea.setAncestors("0");
|
||||||
|
allocArea.setStatus("0");//默认启用
|
||||||
|
} else {
|
||||||
|
AllocArea info = allocAreaMapper.selectAllocAreaByAreaId(allocArea.getParentId());
|
||||||
|
allocArea.setAncestors(info.getAncestors() + "," + allocArea.getParentId());
|
||||||
|
}
|
||||||
|
allocArea.setAreaId(Id.next());
|
||||||
|
return allocAreaMapper.insertAllocArea(allocArea);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException("新增区域错误" + e.getMessage());
|
throw new ServiceException("新增区域错误" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +79,7 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||||
public int updateAllocArea(AllocArea sysAllocArea) {
|
public int updateAllocArea(AllocArea sysAllocArea) {
|
||||||
sysAllocArea.setUpdateTime(DateUtils.getNowDate());
|
sysAllocArea.setUpdateTime(DateUtils.getNowDate());
|
||||||
try {
|
try {
|
||||||
return sysAllocAreaMapper.updateAllocArea(sysAllocArea);
|
return allocAreaMapper.updateAllocArea(sysAllocArea);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException("错误信息描述");
|
throw new ServiceException("错误信息描述");
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +93,7 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAllocAreaByAreaIds(Long[] areaIds) {
|
public int deleteAllocAreaByAreaIds(Long[] areaIds) {
|
||||||
return sysAllocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
|
return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -95,6 +104,6 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAllocAreaByAreaId(Long areaId) {
|
public int deleteAllocAreaByAreaId(Long areaId) {
|
||||||
return sysAllocAreaMapper.deleteAllocAreaByAreaId(areaId);
|
return allocAreaMapper.deleteAllocAreaByAreaId(areaId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where area_id = #{areaId}
|
where area_id = #{areaId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertAllocArea" parameterType="com.bonus.system.domain.AllocArea">
|
<insert id="insertAllocArea" parameterType="com.bonus.system.domain.AllocArea" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into 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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue