30 changed files with 928 additions and 39 deletions
@ -0,0 +1,83 @@ |
|||
package com.kms.yxgh.df.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.kms.yxgh.base.Response; |
|||
import com.kms.yxgh.df.dto.DfDangerousGroupingDto; |
|||
import com.kms.yxgh.df.service.DfDangerousGroupingService; |
|||
import com.shuili.common.annotation.Log; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import com.shuili.common.enums.BusinessType; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* 堤防病险工程分组 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@RestController |
|||
@AllArgsConstructor |
|||
@RequestMapping("/run/df/dangerousGrouping") |
|||
@Api(tags = "堤防病险工程分组") |
|||
public class DfDangerousGroupingController { |
|||
|
|||
private final DfDangerousGroupingService groupingService; |
|||
|
|||
/** |
|||
* 查询堤防病险工程分组列表 |
|||
* @param sp |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程分组列表") |
|||
@PostMapping("/page") |
|||
public Response<IPage<DfDangerousGroupingDto>> page(@RequestBody SearchParam<DfDangerousGroupingDto> sp) { |
|||
return Response.ok(groupingService.getListByPage(sp)); |
|||
} |
|||
|
|||
/** |
|||
* 查询堤防病险工程分组详情 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程分组详情") |
|||
@GetMapping("/{id}") |
|||
public Response<DfDangerousGroupingDto> detail(@PathVariable String id) { |
|||
return Response.ok(groupingService.getDetailById(id)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增堤防病险工程分组 |
|||
*/ |
|||
@ApiOperation("堤防病险工程分组新增") |
|||
@Log(title = "堤防病险工程分组新增", businessType = BusinessType.INSERT) |
|||
@PostMapping() |
|||
public Response<DfDangerousGroupingDto> add(@RequestBody DfDangerousGroupingDto dto) { |
|||
return Response.ok(groupingService.add(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 修改堤防病险工程分组 |
|||
*/ |
|||
@ApiOperation("堤防病险工程分组修改") |
|||
@Log(title = "堤防病险工程分组修改", businessType = BusinessType.UPDATE) |
|||
@PutMapping() |
|||
public Response<DfDangerousGroupingDto> update(@RequestBody DfDangerousGroupingDto dto) { |
|||
return Response.ok(groupingService.modify(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 删除堤防病险工程分组 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程分组删除") |
|||
@Log(title = "堤防病险工程分组删除", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{id}") |
|||
public Response<Boolean> deleteData(@PathVariable String id) { |
|||
return Response.ok(groupingService.deleteById(id)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.kms.yxgh.df.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 堤防病险工程核查分组表 bs_sgc_df_bxgcfz |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_df_bxgcfz") |
|||
@Data |
|||
@ApiModel("堤防病险工程核查分组") |
|||
public class DfDangerousGrouping extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 小组名称 |
|||
*/ |
|||
@ApiModelProperty("小组名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 单位id |
|||
*/ |
|||
@ApiModelProperty("单位id") |
|||
private String deptId; |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.kms.yxgh.df.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 堤防病险工程核查分组成员关系表 bs_sgc_df_bxgcfzcy |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_df_bxgcfzcy") |
|||
@Data |
|||
@ApiModel("堤防病险工程核查分组成员关联") |
|||
public class DfDangerousGroupingRel extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 病险工程核查分组ID |
|||
*/ |
|||
@ApiModelProperty("病险工程核查分组ID") |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 小组成员ID |
|||
*/ |
|||
@ApiModelProperty("小组成员ID") |
|||
private String groupUid; |
|||
|
|||
/** |
|||
* 小组成员名称 |
|||
*/ |
|||
@ApiModelProperty("小组成员名称") |
|||
private String groupName; |
|||
|
|||
/** |
|||
* 所属单位ID |
|||
*/ |
|||
@ApiModelProperty("所属单位ID") |
|||
private String deptId; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.kms.yxgh.df.dto; |
|||
|
|||
import com.kms.yxgh.df.domain.DfDangerousGroupingRel; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 堤防病险工程核查分组dto对象 |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@Data |
|||
@ApiModel("堤防病险工程核查分组") |
|||
public class DfDangerousGroupingDto { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ApiModelProperty("id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 小组名称 |
|||
*/ |
|||
@ApiModelProperty("小组名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 单位id |
|||
*/ |
|||
@ApiModelProperty("单位id") |
|||
private String deptId; |
|||
|
|||
/** |
|||
* 创建单位 |
|||
*/ |
|||
@ApiModelProperty("创建单位") |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 小组成员 |
|||
*/ |
|||
@ApiModelProperty("小组成员") |
|||
private String groupNames; |
|||
|
|||
|
|||
/** |
|||
* 小组成员列表 |
|||
*/ |
|||
@ApiModelProperty("小组成员列表") |
|||
private List<DfDangerousGroupingRelDto> itemList; |
|||
|
|||
} |
@ -0,0 +1,52 @@ |
|||
package com.kms.yxgh.df.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 堤防病险工程核查分组成员关系dto对象 |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@Data |
|||
@ApiModel("堤防病险工程核查分组成员关联") |
|||
public class DfDangerousGroupingRelDto{ |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ApiModelProperty("id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 病险工程核查分组ID |
|||
*/ |
|||
@ApiModelProperty("病险工程核查分组ID") |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 小组成员ID |
|||
*/ |
|||
@ApiModelProperty("小组成员ID") |
|||
private String groupUid; |
|||
|
|||
/** |
|||
* 小组成员名称 |
|||
*/ |
|||
@ApiModelProperty("小组成员名称") |
|||
private String groupName; |
|||
|
|||
/** |
|||
* 所属单位ID |
|||
*/ |
|||
@ApiModelProperty("所属单位ID") |
|||
private String deptId; |
|||
|
|||
/** |
|||
* 所属单位名称 |
|||
*/ |
|||
@ApiModelProperty("所属单位名称") |
|||
private String deptName; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yxgh.df.domain.DfDangerousGrouping; |
|||
import com.kms.yxgh.df.dto.DfDangerousGroupingDto; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 堤防病险工程分组Mapper接口 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface DfDangerousGroupingMapper extends BaseMapper<DfDangerousGrouping> { |
|||
|
|||
@Select("SELECT b.dept_name as deptName,a.id, a.name, a.dept_id as deptId, a.create_time as createTime, a.update_time as updateTime,GROUP_CONCAT(c.groupName) as groupNames" + |
|||
" FROM bs_sgc_df_bxgcfz a " + |
|||
" LEFT JOIN bs_sgc_df_bxgcfzcy c ON c.groupId = g.id "+ |
|||
" LEFT JOIN sys_dept b ON a.dept_id = b.dept_id" + |
|||
"") |
|||
IPage<DfDangerousGroupingDto> selectByPage(Page<DfDangerousGroupingDto> page, @Param("dto") DfDangerousGroupingDto dto); |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfDangerousGroupingRel; |
|||
import com.kms.yxgh.df.dto.DfDangerousGroupingRelDto; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 堤防病险工程分组关联Mapper接口 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface DfDangerousGroupingRelMapper extends BaseMapper<DfDangerousGroupingRel> { |
|||
|
|||
/** |
|||
* 根据groupId删除 |
|||
* @param groupId |
|||
* @return |
|||
*/ |
|||
int deleteByGroupId(String groupId); |
|||
|
|||
/** |
|||
* 根据groupId查询 |
|||
* @param groupId |
|||
* @return |
|||
*/ |
|||
@Select("select dgr.id,dgr.group_id as groupId, dgr.GROUP_UID as groupUid, dgr.GROUP_NAME as groupName,dgr.dept_id as deptId,sd.dept_name as deptName" + |
|||
" from bs_sgc_df_bxgcfzcy dgr " + |
|||
" left join sy_dept sd on dgr.dept_id = sd.dept_id where group_id = #{groupId}") |
|||
List<DfDangerousGroupingRelDto> selectByGroupId(@Param("groupId") String groupId); |
|||
} |
@ -0,0 +1,84 @@ |
|||
package com.kms.yxgh.df.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yxgh.df.domain.DfDangerousGrouping; |
|||
import com.kms.yxgh.df.domain.DfDangerousGroupingRel; |
|||
import com.kms.yxgh.df.dto.DfDangerousGroupingDto; |
|||
import com.kms.yxgh.df.dto.DfDangerousGroupingRelDto; |
|||
import com.kms.yxgh.df.mapper.DfDangerousGroupingMapper; |
|||
import com.kms.yxgh.df.mapper.DfDangerousGroupingRelMapper; |
|||
import com.kms.yxgh.util.BeanCopyUtils; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* 堤防病险工程核查分组实现类 |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 14:46 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class DfDangerousGroupingService extends BaseService<DfDangerousGroupingMapper, DfDangerousGrouping> { |
|||
|
|||
private final DfDangerousGroupingRelMapper relMapper; |
|||
|
|||
public IPage<DfDangerousGroupingDto> getListByPage(SearchParam<DfDangerousGroupingDto> sp) { |
|||
Page<DfDangerousGroupingDto> page = new Page<>(sp.getPageNum(), sp.getPageSize()); |
|||
return this.getBaseMapper().selectByPage(page, sp.getData()); |
|||
} |
|||
|
|||
public DfDangerousGroupingDto getDetailById(String id) { |
|||
DfDangerousGrouping dfDangerousGrouping = this.getById(id); |
|||
DfDangerousGroupingDto dfDangerousGroupingDto = BeanCopyUtils.copy(dfDangerousGrouping, DfDangerousGroupingDto.class); |
|||
dfDangerousGroupingDto.setItemList(relMapper.selectByGroupId(id)); |
|||
return dfDangerousGroupingDto; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public DfDangerousGroupingDto add(DfDangerousGroupingDto groupingDto) { |
|||
// 新增分组
|
|||
DfDangerousGrouping dfDangerousGrouping = BeanCopyUtils.copy(groupingDto, DfDangerousGrouping.class); |
|||
this.save(dfDangerousGrouping); |
|||
|
|||
// 新增小组成员列表
|
|||
handleGroupingRel(groupingDto, dfDangerousGrouping); |
|||
return BeanCopyUtils.copy(dfDangerousGrouping, DfDangerousGroupingDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public DfDangerousGroupingDto modify(DfDangerousGroupingDto groupingDto) { |
|||
// 修改分组
|
|||
DfDangerousGrouping dfDangerousGrouping = BeanCopyUtils.copy(groupingDto, DfDangerousGrouping.class); |
|||
this.updateById(dfDangerousGrouping); |
|||
|
|||
// 批量删除小组成员列表 重新添加
|
|||
relMapper.deleteByGroupId(dfDangerousGrouping.getId()); |
|||
handleGroupingRel(groupingDto, dfDangerousGrouping); |
|||
return BeanCopyUtils.copy(dfDangerousGrouping, DfDangerousGroupingDto.class); |
|||
} |
|||
|
|||
private void handleGroupingRel(DfDangerousGroupingDto groupingDto, DfDangerousGrouping dfDangerousGrouping) { |
|||
for (DfDangerousGroupingRelDto item : groupingDto.getItemList()) { |
|||
DfDangerousGroupingRel itemEntity = BeanCopyUtils.copy(item, DfDangerousGroupingRel.class); |
|||
itemEntity.setId(null); |
|||
itemEntity.setGroupId(dfDangerousGrouping.getId()); |
|||
relMapper.insert(itemEntity); |
|||
} |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean deleteById(String id) { |
|||
if (this.removeById(id)){ |
|||
// 除掉所配置的数据项
|
|||
relMapper.delete(Wrappers.<DfDangerousGroupingRel>lambdaQuery().eq(DfDangerousGroupingRel::getGroupId, id)); |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,123 @@ |
|||
package com.kms.yxgh.sz.controller; |
|||
|
|||
import com.kms.yxgh.base.Response; |
|||
import com.kms.yxgh.sz.dto.SzDangerousProjectDto; |
|||
import com.kms.yxgh.sz.dto.SzDangerousProjectItemDto; |
|||
import com.kms.yxgh.sz.service.SzDangerousProjectService; |
|||
import com.shuili.common.annotation.Log; |
|||
import com.shuili.common.enums.BusinessType; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 水闸病险工程核查项目 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@RestController |
|||
@AllArgsConstructor |
|||
@RequestMapping("/run/sz/dangerousProject") |
|||
@Api(tags = "水闸病险工程核查项目") |
|||
public class SzDangerousProjectController { |
|||
|
|||
private final SzDangerousProjectService dangerousProjectService; |
|||
|
|||
/** |
|||
* 查询水闸病险工程核查项目列表 |
|||
* @param dto |
|||
* @return |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目列表") |
|||
@PostMapping("/list") |
|||
public Response<List<SzDangerousProjectDto>> list(@RequestBody SzDangerousProjectDto dto) { |
|||
return Response.ok(dangerousProjectService.getList(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 查询水闸病险工程核查项目详情 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目详情") |
|||
@GetMapping("/{id}") |
|||
public Response<SzDangerousProjectDto> detail(@PathVariable String id) { |
|||
return Response.ok(dangerousProjectService.getDetailById(id)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增/修改水闸病险工程核查项目 |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目新增/修改") |
|||
@Log(title = "水闸病险工程核查项目新增/修改", businessType = BusinessType.INSERT) |
|||
@PostMapping() |
|||
public Response<SzDangerousProjectDto> addOrModify(@RequestBody SzDangerousProjectDto dto) { |
|||
return Response.ok(dangerousProjectService.addOrModify(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 删除水闸病险工程核查项目 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目删除") |
|||
@Log(title = "水闸病险工程核查项目删除", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{id}") |
|||
public Response<Boolean> deleteData(@PathVariable String id) { |
|||
return Response.ok(dangerousProjectService.deleteById(id)); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 新增/修改水闸病险工程核查项目内容 |
|||
* @param item |
|||
* @return |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目内容新增/修改") |
|||
@Log(title = "水闸病险工程核查项目内容新增/修改", businessType = BusinessType.INSERT) |
|||
@PostMapping("/item") |
|||
public Response<SzDangerousProjectItemDto> addOrModifyItem(@RequestBody SzDangerousProjectItemDto item) { |
|||
return Response.ok(dangerousProjectService.addOrModifyItem(item)); |
|||
} |
|||
|
|||
/** |
|||
* 删除水闸病险工程核查项目内容 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目内容删除") |
|||
@Log(title = "水闸病险工程核查项目内容删除", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/item/{id}") |
|||
public Response<Boolean> deleteItem(@PathVariable String id) { |
|||
return Response.ok(dangerousProjectService.deleteItemById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 查询水闸病险工程核查项目内容列表 |
|||
* @param projectId |
|||
* @return |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目内容列表") |
|||
@GetMapping("/itemList/{projectId}") |
|||
public Response<List<SzDangerousProjectItemDto>> getItemList(@PathVariable String projectId) { |
|||
return Response.ok(dangerousProjectService.getItemList(projectId)); |
|||
} |
|||
|
|||
/** |
|||
* 查询水闸病险工程核查项目内容详情 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("水闸病险工程核查项目内容详情") |
|||
@GetMapping("/itemDetail/{id}") |
|||
public Response<SzDangerousProjectItemDto> getItemDetailById(@PathVariable String id) { |
|||
return Response.ok(dangerousProjectService.getItemDetailById(id)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.kms.yxgh.sz.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸病险工程核查项目表 bs_sgc_sz_bxgcxm |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_sz_bxgcxm") |
|||
@Data |
|||
@ApiModel("水闸病险工程核查项目") |
|||
public class SzDangerousProject extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.kms.yxgh.sz.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸病险工程核查项目内容表 bs_sgc_sz_bxgcxmnr |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_sz_bxgcxmnr") |
|||
@Data |
|||
@ApiModel("水闸病险工程核查项目内容") |
|||
public class SzDangerousProjectItem extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 病险工程核查项目ID |
|||
*/ |
|||
@ApiModelProperty("病险工程核查项目ID") |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 检查内容 |
|||
*/ |
|||
@ApiModelProperty("检查内容") |
|||
private String content; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.kms.yxgh.sz.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸病险工程核查项目dto对象 |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@Data |
|||
@ApiModel("水闸病险工程核查项目") |
|||
public class SzDangerousProjectDto { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ApiModelProperty("id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.kms.yxgh.sz.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸病险工程核查项目内容dto对象 |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@Data |
|||
@ApiModel("水闸病险工程核查项目内容") |
|||
public class SzDangerousProjectItemDto { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ApiModelProperty("id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 病险工程核查项目ID |
|||
*/ |
|||
@ApiModelProperty("病险工程核查项目ID") |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 检查内容 |
|||
*/ |
|||
@ApiModelProperty("检查内容") |
|||
private String content; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.kms.yxgh.sz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.sz.domain.SzDangerousProjectItem; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 水闸病险工程核查项目内容Mapper接口 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface SzDangerousProjectItemMapper extends BaseMapper<SzDangerousProjectItem> { |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.kms.yxgh.sz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.sz.domain.SzDangerousProject; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 水闸病险工程Mapper接口 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface SzDangerousProjectMapper extends BaseMapper<SzDangerousProject> { |
|||
} |
@ -0,0 +1,88 @@ |
|||
package com.kms.yxgh.sz.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.kms.yxgh.sz.domain.SzDangerousProject; |
|||
import com.kms.yxgh.sz.domain.SzDangerousProjectItem; |
|||
import com.kms.yxgh.sz.dto.SzDangerousProjectDto; |
|||
import com.kms.yxgh.sz.dto.SzDangerousProjectItemDto; |
|||
import com.kms.yxgh.sz.mapper.SzDangerousProjectItemMapper; |
|||
import com.kms.yxgh.sz.mapper.SzDangerousProjectMapper; |
|||
import com.kms.yxgh.util.BeanCopyUtils; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 水闸病险工程核查项目实现类 |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 14:46 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class SzDangerousProjectService extends BaseService<SzDangerousProjectMapper, SzDangerousProject> { |
|||
|
|||
private final SzDangerousProjectItemMapper projectItemMapper; |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public SzDangerousProjectDto addOrModify(SzDangerousProjectDto dto) { |
|||
// 新增
|
|||
SzDangerousProject dangerousProject = BeanCopyUtils.copy(dto, SzDangerousProject.class); |
|||
if (dto.getId() == null) { |
|||
this.save(dangerousProject); |
|||
} else { |
|||
// 修改
|
|||
this.updateById(dangerousProject); |
|||
} |
|||
return BeanCopyUtils.copy(dangerousProject, SzDangerousProjectDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean deleteById(String id) { |
|||
if (this.removeById(id)) { |
|||
// 除掉所配置的数据项
|
|||
projectItemMapper.delete(Wrappers.<SzDangerousProjectItem>lambdaQuery().eq(SzDangerousProjectItem::getProjectId, id)); |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
public List<SzDangerousProjectDto> getList(SzDangerousProjectDto dto) { |
|||
List<SzDangerousProject> list = this.list(); |
|||
return BeanCopyUtils.copyList(list, SzDangerousProjectDto.class); |
|||
} |
|||
|
|||
public SzDangerousProjectDto getDetailById(String id) { |
|||
SzDangerousProject dangerousProject = this.getById(id); |
|||
return BeanCopyUtils.copy(dangerousProject, SzDangerousProjectDto.class); |
|||
} |
|||
|
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public SzDangerousProjectItemDto addOrModifyItem(SzDangerousProjectItemDto item) { |
|||
SzDangerousProjectItem projectItem = BeanCopyUtils.copy(item, SzDangerousProjectItem.class); |
|||
if (item.getId() == null) { |
|||
projectItemMapper.insert(projectItem); |
|||
} else { |
|||
projectItemMapper.updateById(projectItem); |
|||
} |
|||
return BeanCopyUtils.copy(item, SzDangerousProjectItemDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean deleteItemById(String id) { |
|||
projectItemMapper.deleteById(id); |
|||
return true; |
|||
} |
|||
|
|||
public List<SzDangerousProjectItemDto> getItemList(String projectId) { |
|||
List<SzDangerousProjectItem> itemList = projectItemMapper.selectList(Wrappers.<SzDangerousProjectItem>lambdaQuery().eq(SzDangerousProjectItem::getProjectId, projectId)); |
|||
return BeanCopyUtils.copyList(itemList, SzDangerousProjectItemDto.class); |
|||
} |
|||
|
|||
public SzDangerousProjectItemDto getItemDetailById(String id) { |
|||
return BeanCopyUtils.copy(projectItemMapper.selectById(id), SzDangerousProjectItemDto.class); |
|||
} |
|||
} |
Loading…
Reference in new issue