制度模块按需求修改完成,且通过测试
This commit is contained in:
parent
78c23c019c
commit
258806b499
|
@ -19,9 +19,13 @@ public interface RegulationMapper extends BaseMapper<RegulationEntity> {
|
||||||
* @param page 分页参数
|
* @param page 分页参数
|
||||||
* @param status 状态
|
* @param status 状态
|
||||||
* @param type 类型
|
* @param type 类型
|
||||||
|
* @param title 提案标题
|
||||||
|
* @param proposer 提案人
|
||||||
* @return 分页结果
|
* @return 分页结果
|
||||||
*/
|
*/
|
||||||
Page<RegulationEntity> selectRegulationListWithCreator(Page<RegulationEntity> page,
|
Page<RegulationEntity> selectRegulationListWithCreator(Page<RegulationEntity> page,
|
||||||
@Param("status") String status,
|
@Param("status") String status,
|
||||||
@Param("type") String type);
|
@Param("type") String type,
|
||||||
|
@Param("title") String title,
|
||||||
|
@Param("proposer") String proposer);
|
||||||
}
|
}
|
|
@ -18,7 +18,12 @@ public interface RegulationTypeMapper extends BaseMapper<RegulationTypeEntity> {
|
||||||
* 分页查询制度类型列表(包含创建人姓名)
|
* 分页查询制度类型列表(包含创建人姓名)
|
||||||
* @param page 分页参数
|
* @param page 分页参数
|
||||||
* @param typeName 类型名称
|
* @param typeName 类型名称
|
||||||
|
* @param status 状态
|
||||||
|
* @param remark 备注
|
||||||
* @return 分页结果
|
* @return 分页结果
|
||||||
*/
|
*/
|
||||||
Page<RegulationTypeEntity> selectRegulationTypeListWithCreator(Page<RegulationTypeEntity> page, @Param("typeName") String typeName);
|
Page<RegulationTypeEntity> selectRegulationTypeListWithCreator(Page<RegulationTypeEntity> page,
|
||||||
|
@Param("typeName") String typeName,
|
||||||
|
@Param("status") String status,
|
||||||
|
@Param("remark") String remark);
|
||||||
}
|
}
|
|
@ -17,9 +17,11 @@ public interface RegulationService extends IService<RegulationEntity> {
|
||||||
* @param pageSize 页大小
|
* @param pageSize 页大小
|
||||||
* @param status 状态
|
* @param status 状态
|
||||||
* @param type 类型
|
* @param type 类型
|
||||||
|
* @param title 提案标题
|
||||||
|
* @param proposer 提案人
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
Result getRegulationList(Integer page, Integer pageSize, String status, String type);
|
Result getRegulationList(Integer page, Integer pageSize, String status, String type, String title, String proposer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建制度提案
|
* 创建制度提案
|
||||||
|
|
|
@ -16,9 +16,11 @@ public interface RegulationTypeService extends IService<RegulationTypeEntity> {
|
||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @param size 页大小
|
* @param size 页大小
|
||||||
* @param typeName 类型名称
|
* @param typeName 类型名称
|
||||||
|
* @param status 状态
|
||||||
|
* @param remark 备注
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
Result getRegulationTypes(Integer page, Integer size, String typeName);
|
Result getRegulationTypes(Integer page, Integer size, String typeName, String status, String remark);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建制度类型
|
* 创建制度类型
|
||||||
|
|
|
@ -68,12 +68,12 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public Result getRegulationList(Integer page, Integer pageSize, String status, String type) {
|
public Result getRegulationList(Integer page, Integer pageSize, String status, String type, String title, String proposer) {
|
||||||
try {
|
try {
|
||||||
Page<RegulationEntity> pageParam = new Page<>(page, pageSize);
|
Page<RegulationEntity> pageParam = new Page<>(page, pageSize);
|
||||||
|
|
||||||
// 使用关联查询获取创建人姓名
|
// 使用关联查询获取创建人姓名
|
||||||
Page<RegulationEntity> result = this.baseMapper.selectRegulationListWithCreator(pageParam, status, type);
|
Page<RegulationEntity> result = this.baseMapper.selectRegulationListWithCreator(pageParam, status, type, title, proposer);
|
||||||
|
|
||||||
// 如果是获取已发布的制度,需要添加确认状态
|
// 如果是获取已发布的制度,需要添加确认状态
|
||||||
if (status != null && "PUBLISHED".equals(status)) {
|
if (status != null && "PUBLISHED".equals(status)) {
|
||||||
|
|
|
@ -5,12 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.dite.znpt.domain.Result;
|
import com.dite.znpt.domain.Result;
|
||||||
import com.dite.znpt.domain.entity.RegulationTypeEntity;
|
|
||||||
import com.dite.znpt.domain.entity.RegulationEntity;
|
import com.dite.znpt.domain.entity.RegulationEntity;
|
||||||
import com.dite.znpt.mapper.RegulationTypeMapper;
|
import com.dite.znpt.domain.entity.RegulationTypeEntity;
|
||||||
import com.dite.znpt.mapper.RegulationMapper;
|
import com.dite.znpt.mapper.RegulationMapper;
|
||||||
|
import com.dite.znpt.mapper.RegulationTypeMapper;
|
||||||
import com.dite.znpt.service.RegulationTypeService;
|
import com.dite.znpt.service.RegulationTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -24,17 +23,20 @@ import java.time.LocalDateTime;
|
||||||
@Service
|
@Service
|
||||||
public class RegulationTypeServiceImpl extends ServiceImpl<RegulationTypeMapper, RegulationTypeEntity> implements RegulationTypeService {
|
public class RegulationTypeServiceImpl extends ServiceImpl<RegulationTypeMapper, RegulationTypeEntity> implements RegulationTypeService {
|
||||||
|
|
||||||
@Autowired
|
private final RegulationMapper regulationMapper;
|
||||||
private RegulationMapper regulationMapper;
|
|
||||||
|
public RegulationTypeServiceImpl(RegulationMapper regulationMapper) {
|
||||||
|
this.regulationMapper = regulationMapper;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public Result getRegulationTypes(Integer page, Integer size, String typeName) {
|
public Result getRegulationTypes(Integer page, Integer size, String typeName, String status, String remark) {
|
||||||
try {
|
try {
|
||||||
Page<RegulationTypeEntity> pageParam = new Page<>(page, size);
|
Page<RegulationTypeEntity> pageParam = new Page<>(page, size);
|
||||||
|
|
||||||
// 使用连表查询获取创建人姓名
|
// 使用连表查询获取创建人姓名
|
||||||
Page<RegulationTypeEntity> result = this.baseMapper.selectRegulationTypeListWithCreator(pageParam, typeName);
|
Page<RegulationTypeEntity> result = this.baseMapper.selectRegulationTypeListWithCreator(pageParam, typeName, status, remark);
|
||||||
|
|
||||||
return Result.ok(result);
|
return Result.ok(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -26,8 +26,10 @@ public class RegulationController {
|
||||||
public Result getRegulationList(@RequestParam(defaultValue = "1") int page,
|
public Result getRegulationList(@RequestParam(defaultValue = "1") int page,
|
||||||
@RequestParam(defaultValue = "10") int size,
|
@RequestParam(defaultValue = "10") int size,
|
||||||
@RequestParam(required = false) String status,
|
@RequestParam(required = false) String status,
|
||||||
@RequestParam(required = false) String type) {
|
@RequestParam(required = false) String type,
|
||||||
return regulationService.getRegulationList(page, size, status, type);
|
@RequestParam(required = false) String title,
|
||||||
|
@RequestParam(required = false) String proposer) {
|
||||||
|
return regulationService.getRegulationList(page, size, status, type, title, proposer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "创建制度提案", httpMethod = "POST")
|
@ApiOperation(value = "创建制度提案", httpMethod = "POST")
|
||||||
|
|
|
@ -25,8 +25,10 @@ public class RegulationTypeController {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public Result getRegulationTypes(@RequestParam(defaultValue = "1") int page,
|
public Result getRegulationTypes(@RequestParam(defaultValue = "1") int page,
|
||||||
@RequestParam(defaultValue = "10") int size,
|
@RequestParam(defaultValue = "10") int size,
|
||||||
@RequestParam(required = false) String typeName) {
|
@RequestParam(required = false) String typeName,
|
||||||
return regulationTypeService.getRegulationTypes(page, size, typeName);
|
@RequestParam(required = false) String status,
|
||||||
|
@RequestParam(required = false) String remark) {
|
||||||
|
return regulationTypeService.getRegulationTypes(page, size, typeName, status, remark);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "创建制度类型", httpMethod = "POST")
|
@ApiOperation(value = "创建制度类型", httpMethod = "POST")
|
||||||
|
|
Loading…
Reference in New Issue