Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev
This commit is contained in:
commit
0548422b4b
@ -0,0 +1,85 @@
|
||||
package cn.iocoder.yudao.module.inspection.controller;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.service.DlInspectionProjectService;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 检测项目")
|
||||
@RestController
|
||||
@RequestMapping("/admin-api/inspection/dl-inspection-project")
|
||||
@Validated
|
||||
public class DlInspectionProjectController {
|
||||
|
||||
@Resource
|
||||
private DlInspectionProjectService dlInspectionProjectService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检测项目")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:create')")
|
||||
public CommonResult<String> createDlInspectionProject(@Valid @RequestBody DlInspectionProjectSaveReqVO createReqVO) {
|
||||
return success(dlInspectionProjectService.createDlInspectionProject(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新检测项目")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:update')")
|
||||
public CommonResult<Boolean> updateDlInspectionProject(@Valid @RequestBody DlInspectionProjectSaveReqVO updateReqVO) {
|
||||
dlInspectionProjectService.updateDlInspectionProject(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除检测项目")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:delete')")
|
||||
public CommonResult<Boolean> deleteDlInspectionProject(@RequestParam("id") String id) {
|
||||
dlInspectionProjectService.deleteDlInspectionProject(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得检测项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:query')")
|
||||
public CommonResult<DlInspectionProjectRespVO> getDlInspectionProject(@RequestParam("id") String id) {
|
||||
DlInspectionProject dlInspectionProject = dlInspectionProjectService.getDlInspectionProject(id);
|
||||
return success(BeanUtils.toBean(dlInspectionProject, DlInspectionProjectRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检测项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('inspection:dl-inspection-project:query')")
|
||||
public CommonResult<IPage<DlInspectionProjectRespVO>> getDlInspectionProjectPage(@Valid DlInspectionProjectPageReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
IPage page = new Page<>(pageNo, pageSize);
|
||||
IPage<DlInspectionProjectRespVO> pageResult = dlInspectionProjectService.getDlInspectionProjectPage(page,pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.inspection.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 检测项目
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("inspection_project")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DlInspectionProject extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 检测项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
/**
|
||||
* 角色id(system_role表的id)
|
||||
*/
|
||||
private Long roleId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.inspection.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 检测项目 Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface DlInspectionProjectMapper extends BaseMapper<DlInspectionProject> {
|
||||
IPage<DlInspectionProjectRespVO> selectListPage(@Param("page") IPage page,@Param("entity") DlInspectionProjectPageReqVO pageReqVO);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.inspection.service;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 检测项目 Service 接口
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
public interface DlInspectionProjectService extends IService<DlInspectionProject> {
|
||||
|
||||
/**
|
||||
* 创建检测项目
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createDlInspectionProject(@Valid DlInspectionProjectSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新检测项目
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDlInspectionProject(@Valid DlInspectionProjectSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除检测项目
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDlInspectionProject(String id);
|
||||
|
||||
/**
|
||||
* 获得检测项目
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 检测项目
|
||||
*/
|
||||
DlInspectionProject getDlInspectionProject(String id);
|
||||
|
||||
/**
|
||||
* 获得检测项目分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 检测项目分页
|
||||
*/
|
||||
IPage<DlInspectionProjectRespVO> getDlInspectionProjectPage(IPage page, DlInspectionProjectPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.DlInspectionProjectMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.DlInspectionProjectService;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO;
|
||||
import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* 检测项目 Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DlInspectionProjectServiceImpl extends ServiceImpl<DlInspectionProjectMapper, DlInspectionProject> implements DlInspectionProjectService {
|
||||
|
||||
@Resource
|
||||
private DlInspectionProjectMapper dlInspectionProjectMapper;
|
||||
|
||||
@Override
|
||||
public String createDlInspectionProject(DlInspectionProjectSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
DlInspectionProject dlInspectionProject = BeanUtils.toBean(createReqVO, DlInspectionProject.class);
|
||||
dlInspectionProject.setDeleted(false);
|
||||
dlInspectionProjectMapper.insert(dlInspectionProject);
|
||||
// 返回
|
||||
return dlInspectionProject.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDlInspectionProject(DlInspectionProjectSaveReqVO updateReqVO) {
|
||||
|
||||
// 更新
|
||||
DlInspectionProject updateObj = BeanUtils.toBean(updateReqVO, DlInspectionProject.class);
|
||||
dlInspectionProjectMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDlInspectionProject(String id) {
|
||||
// 删除
|
||||
dlInspectionProjectMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DlInspectionProject getDlInspectionProject(String id) {
|
||||
return dlInspectionProjectMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DlInspectionProjectRespVO> getDlInspectionProjectPage(IPage page, DlInspectionProjectPageReqVO pageReqVO) {
|
||||
return baseMapper.selectListPage(page, pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 检测项目分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DlInspectionProjectPageReqVO extends DlInspectionProject {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 检测项目 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DlInspectionProjectRespVO extends DlInspectionProject {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.inspection.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 检测项目新增/修改 Request VO")
|
||||
@Data
|
||||
public class DlInspectionProjectSaveReqVO extends DlInspectionProject {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.inspection.mapper.DlInspectionProjectMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectListPage" resultType="cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
inspection_project
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="entity.projectName != null and entity.projectName != ''">
|
||||
AND project_name LIKE concat('%',#{entity.projectName},'%')
|
||||
</if>
|
||||
<if test="entity.roleId != null and entity.roleId != ''">
|
||||
AND role_id = #{entity.roleId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user