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 {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/** 区域id */
|
||||
private Long areaId;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import com.bonus.system.service.IAllocAreaService;
|
|||
@Service
|
||||
public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||
@Autowired
|
||||
private AllocAreaMapper sysAllocAreaMapper;
|
||||
private AllocAreaMapper allocAreaMapper;
|
||||
|
||||
/**
|
||||
* 查询区域
|
||||
|
|
@ -29,7 +29,7 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
*/
|
||||
@Override
|
||||
public AllocArea selectAllocAreaByAreaId(Long areaId) {
|
||||
return sysAllocAreaMapper.selectAllocAreaByAreaId(areaId);
|
||||
return allocAreaMapper.selectAllocAreaByAreaId(areaId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -40,21 +40,30 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
*/
|
||||
@Override
|
||||
public List<AllocArea> selectAllocAreaList(AllocArea sysAllocArea) {
|
||||
return sysAllocAreaMapper.selectAllocAreaList(sysAllocArea);
|
||||
return allocAreaMapper.selectAllocAreaList(sysAllocArea);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增区域
|
||||
*
|
||||
* @param sysAllocArea 区域
|
||||
* @param allocArea 区域
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAllocArea(AllocArea sysAllocArea) {
|
||||
sysAllocArea.setCreateTime(DateUtils.getNowDate());
|
||||
public int insertAllocArea(AllocArea allocArea) {
|
||||
allocArea.setCreateTime(DateUtils.getNowDate());
|
||||
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) {
|
||||
throw new ServiceException("新增区域错误" + e.getMessage());
|
||||
}
|
||||
|
|
@ -70,7 +79,7 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
public int updateAllocArea(AllocArea sysAllocArea) {
|
||||
sysAllocArea.setUpdateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
return sysAllocAreaMapper.updateAllocArea(sysAllocArea);
|
||||
return allocAreaMapper.updateAllocArea(sysAllocArea);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
|
|
@ -84,7 +93,7 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteAllocAreaByAreaIds(Long[] areaIds) {
|
||||
return sysAllocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
|
||||
return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,6 +104,6 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
*/
|
||||
@Override
|
||||
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}
|
||||
</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
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="areaId != null">area_id,</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue