增加区块和部门接口
This commit is contained in:
parent
d9362860f3
commit
1731a9b6aa
|
@ -29,10 +29,10 @@ public class Block extends Model<Block> {
|
|||
private String details;
|
||||
|
||||
/** 创建时间 */
|
||||
private LocalDateTime createTime;
|
||||
private String createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
private LocalDateTime updateTime;
|
||||
private String updateTime;
|
||||
|
||||
/** 关联部门 */
|
||||
private DepartmentVO department;
|
||||
|
|
|
@ -145,6 +145,8 @@ public class BlockServiceImpl extends ServiceImpl<BlockDao, Block> implements B
|
|||
@Override
|
||||
@Transactional(rollbackFor = Throwable.class)
|
||||
public void deleteBlockById(Long id) {
|
||||
//TODO 校验区块是否被气井关联
|
||||
|
||||
blockDao.deleteBlockById(id);
|
||||
blockDepartmentService.remove(new LambdaQueryWrapper<BlockDepartment>().eq(BlockDepartment::getBlockId, id));
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.isu.gaswellwatch.config.SnowflakeConfig;
|
||||
import com.isu.gaswellwatch.entity.BlockDepartment;
|
||||
import com.isu.gaswellwatch.service.BlockDepartmentService;
|
||||
import com.isu.gaswellwatch.service.DepartmentService;
|
||||
import com.isu.gaswellwatch.dao.DepartmentDao;
|
||||
import com.isu.gaswellwatch.dto.*;
|
||||
|
@ -28,6 +30,9 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentDao, Department
|
|||
@Resource
|
||||
private DepartmentDao companyDao;
|
||||
|
||||
@Resource
|
||||
private BlockDepartmentService blockDepartmentService;
|
||||
|
||||
@Override
|
||||
public Page<DepartmentVO> page(Integer currentPage, Integer pageSize, String name, String code){
|
||||
Page<DepartmentVO> page = companyDao.page(new Page<>(currentPage, pageSize),name,code);
|
||||
|
@ -56,10 +61,13 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentDao, Department
|
|||
|
||||
@Override
|
||||
public void delete(Long id){
|
||||
//TODO 如果部门绑定了气井 不能删除
|
||||
|
||||
//删除
|
||||
removeById(id);
|
||||
//如果部门绑定了区块 不能删除
|
||||
BlockDepartment blockDepartment = blockDepartmentService.getOne(new LambdaQueryWrapper<BlockDepartment>().eq(BlockDepartment::getDepartmentId, id));
|
||||
if(blockDepartment != null){
|
||||
throw new BusinessException("该部门已被区块绑定,不能删除");
|
||||
}else {
|
||||
removeById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="pageForQuery" resultMap="BlockVO">
|
||||
<include refid="selectBlockVo"/>
|
||||
<where>
|
||||
<if test="name != ''"> and t1.name like concat('%', #{name}, '%')</if>
|
||||
<if test="name != null and name != ''"> and t1.name like concat('%', #{name}, '%')</if>
|
||||
</where>
|
||||
order by t1.id desc
|
||||
</select>
|
||||
|
@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectBlockVo"/>
|
||||
left join block_department bd on t1.id = bd.block_id
|
||||
<where>
|
||||
<if test="departmentId != ''"> bd.department_id = #{departmentId}</if>
|
||||
<if test="departmentId != null and departmentId != ''"> bd.department_id = #{departmentId}</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue