8 changed files with 357 additions and 0 deletions
@ -0,0 +1,124 @@ |
|||
package com.kms.yxgh.df.controller; |
|||
|
|||
import com.kms.yxgh.base.Response; |
|||
import com.kms.yxgh.df.domain.DfDangerousProjectItem; |
|||
import com.kms.yxgh.df.dto.DfDangerousProjectDto; |
|||
import com.kms.yxgh.df.dto.DfDangerousProjectItemDto; |
|||
import com.kms.yxgh.df.service.DfDangerousProjectService; |
|||
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/df/dangerousProject") |
|||
@Api(tags = "堤防病险工程核查项目") |
|||
public class DfDangerousProjectController { |
|||
|
|||
private final DfDangerousProjectService dfDangerousProjectService; |
|||
|
|||
/** |
|||
* 查询堤防病险工程核查项目列表 |
|||
* @param dto |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目列表") |
|||
@PostMapping("/list") |
|||
public Response<List<DfDangerousProjectDto>> list(@RequestBody DfDangerousProjectDto dto) { |
|||
return Response.ok(dfDangerousProjectService.getList(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 查询堤防病险工程核查项目详情 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目详情") |
|||
@GetMapping("/{id}") |
|||
public Response<DfDangerousProjectDto> detail(@PathVariable String id) { |
|||
return Response.ok(dfDangerousProjectService.getDetailById(id)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增/修改堤防病险工程核查项目 |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目新增/修改") |
|||
@Log(title = "堤防病险工程核查项目新增/修改", businessType = BusinessType.INSERT) |
|||
@PostMapping() |
|||
public Response<DfDangerousProjectDto> addOrModify(@RequestBody DfDangerousProjectDto dto) { |
|||
return Response.ok(dfDangerousProjectService.addOrModify(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 删除堤防病险工程核查项目 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目删除") |
|||
@Log(title = "堤防病险工程核查项目删除", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{id}") |
|||
public Response<Boolean> deleteData(@PathVariable String id) { |
|||
return Response.ok(dfDangerousProjectService.deleteById(id)); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 新增/修改堤防病险工程核查项目内容 |
|||
* @param item |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目内容新增/修改") |
|||
@Log(title = "堤防病险工程核查项目内容新增/修改", businessType = BusinessType.INSERT) |
|||
@PostMapping("/item") |
|||
public Response<DfDangerousProjectItemDto> addOrModifyItem(@RequestBody DfDangerousProjectItem item) { |
|||
return Response.ok(dfDangerousProjectService.addOrModifyItem(item)); |
|||
} |
|||
|
|||
/** |
|||
* 删除堤防病险工程核查项目内容 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目内容删除") |
|||
@Log(title = "堤防病险工程核查项目内容删除", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/item/{id}") |
|||
public Response<Boolean> deleteItem(@PathVariable String id) { |
|||
return Response.ok(dfDangerousProjectService.deleteItemById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 查询堤防病险工程核查项目内容列表 |
|||
* @param projectId |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目内容列表") |
|||
@GetMapping("/itemList/{projectId}") |
|||
public Response<List<DfDangerousProjectItem>> getItemList(@PathVariable String projectId) { |
|||
return Response.ok(dfDangerousProjectService.getItemList(projectId)); |
|||
} |
|||
|
|||
/** |
|||
* 查询堤防病险工程核查项目内容详情 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@ApiOperation("堤防病险工程核查项目内容详情") |
|||
@GetMapping("/itemDetail/{id}") |
|||
public Response<DfDangerousProjectItem> getItemDetailById(@PathVariable String id) { |
|||
return Response.ok(dfDangerousProjectService.getItemDetailById(id)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
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_bxgcxm |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_df_bxgcxm") |
|||
@Data |
|||
@ApiModel("堤防病险工程核查项目") |
|||
public class DfDangerousProject extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
} |
@ -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_bxgcxmnr |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_df_bxgcxmnr") |
|||
@Data |
|||
@ApiModel("堤防病险工程核查项目内容") |
|||
public class DfDangerousProjectItem 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.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 DfDangerousProjectDto{ |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ApiModelProperty("id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
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 DfDangerousProjectItemDto { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@ApiModelProperty("id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 病险工程核查项目ID |
|||
*/ |
|||
@ApiModelProperty("病险工程核查项目ID") |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 检查内容 |
|||
*/ |
|||
@ApiModelProperty("检查内容") |
|||
private String content; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfDangerousProjectItem; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 堤防病险工程核查项目内容Mapper接口 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface DfDangerousProjectItemMapper extends BaseMapper<DfDangerousProjectItem> { |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfDangerousProject; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 堤防病险工程Mapper接口 |
|||
* @author hry |
|||
* @date 2024/3/12 14:44 |
|||
*/ |
|||
@Mapper |
|||
public interface DfDangerousProjectMapper extends BaseMapper<DfDangerousProject> { |
|||
} |
@ -0,0 +1,85 @@ |
|||
package com.kms.yxgh.df.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.kms.yxgh.df.domain.DfDangerousProject; |
|||
import com.kms.yxgh.df.domain.DfDangerousProjectItem; |
|||
import com.kms.yxgh.df.dto.DfDangerousProjectDto; |
|||
import com.kms.yxgh.df.dto.DfDangerousProjectItemDto; |
|||
import com.kms.yxgh.df.mapper.DfDangerousProjectItemMapper; |
|||
import com.kms.yxgh.df.mapper.DfDangerousProjectMapper; |
|||
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 DfDangerousProjectService extends BaseService<DfDangerousProjectMapper, DfDangerousProject> { |
|||
|
|||
private final DfDangerousProjectItemMapper projectItemMapper; |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public DfDangerousProjectDto addOrModify(DfDangerousProjectDto dto) { |
|||
// 新增
|
|||
DfDangerousProject dangerousProject = BeanCopyUtils.copy(dto, DfDangerousProject.class); |
|||
if (dto.getId() == null) { |
|||
this.save(dangerousProject); |
|||
} else { |
|||
// 修改
|
|||
this.updateById(dangerousProject); |
|||
} |
|||
return BeanCopyUtils.copy(dangerousProject, DfDangerousProjectDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean deleteById(String id) { |
|||
this.removeById(id); |
|||
// 除掉所配置的数据项
|
|||
projectItemMapper.delete(Wrappers.<DfDangerousProjectItem>lambdaQuery().eq(DfDangerousProjectItem::getProjectId, id)); |
|||
return true; |
|||
} |
|||
|
|||
public List<DfDangerousProjectDto> getList(DfDangerousProjectDto dto) { |
|||
List<DfDangerousProject> list = this.list(); |
|||
return BeanCopyUtils.copyList(list, DfDangerousProjectDto.class); |
|||
} |
|||
|
|||
public DfDangerousProjectDto getDetailById(String id) { |
|||
DfDangerousProject dangerousProject = this.getById(id); |
|||
return BeanCopyUtils.copy(dangerousProject, DfDangerousProjectDto.class); |
|||
} |
|||
|
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public DfDangerousProjectItemDto addOrModifyItem(DfDangerousProjectItem item) { |
|||
if (item.getId() == null) { |
|||
projectItemMapper.insert(item); |
|||
} else { |
|||
projectItemMapper.updateById(item); |
|||
} |
|||
return BeanCopyUtils.copy(item, DfDangerousProjectItemDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean deleteItemById(String id) { |
|||
projectItemMapper.deleteById(id); |
|||
return true; |
|||
} |
|||
|
|||
public List<DfDangerousProjectItem> getItemList(String projectId) { |
|||
return projectItemMapper.selectList(Wrappers.<DfDangerousProjectItem>lambdaQuery().eq(DfDangerousProjectItem::getProjectId, projectId)); |
|||
} |
|||
|
|||
public DfDangerousProjectItem getItemDetailById(String id) { |
|||
return projectItemMapper.selectById(id); |
|||
} |
|||
} |
Loading…
Reference in new issue