11 changed files with 372 additions and 11 deletions
@ -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