制度模块按需求修改完成,且通过测试

This commit is contained in:
wangna0328 2025-08-01 17:18:01 +08:00
parent 78c23c019c
commit 258806b499
8 changed files with 36 additions and 17 deletions

View File

@ -19,9 +19,13 @@ public interface RegulationMapper extends BaseMapper<RegulationEntity> {
* @param page 分页参数
* @param status 状态
* @param type 类型
* @param title 提案标题
* @param proposer 提案人
* @return 分页结果
*/
Page<RegulationEntity> selectRegulationListWithCreator(Page<RegulationEntity> page,
@Param("status") String status,
@Param("type") String type);
@Param("type") String type,
@Param("title") String title,
@Param("proposer") String proposer);
}

View File

@ -18,7 +18,12 @@ public interface RegulationTypeMapper extends BaseMapper<RegulationTypeEntity> {
* 分页查询制度类型列表包含创建人姓名
* @param page 分页参数
* @param typeName 类型名称
* @param status 状态
* @param remark 备注
* @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);
}

View File

@ -17,9 +17,11 @@ public interface RegulationService extends IService<RegulationEntity> {
* @param pageSize 页大小
* @param status 状态
* @param type 类型
* @param title 提案标题
* @param proposer 提案人
* @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);
/**
* 创建制度提案

View File

@ -16,9 +16,11 @@ public interface RegulationTypeService extends IService<RegulationTypeEntity> {
* @param page 页码
* @param size 页大小
* @param typeName 类型名称
* @param status 状态
* @param remark 备注
* @return 结果
*/
Result getRegulationTypes(Integer page, Integer size, String typeName);
Result getRegulationTypes(Integer page, Integer size, String typeName, String status, String remark);
/**
* 创建制度类型

View File

@ -68,12 +68,12 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
@Override
@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 {
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)) {

View File

@ -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.service.impl.ServiceImpl;
import com.dite.znpt.domain.Result;
import com.dite.znpt.domain.entity.RegulationTypeEntity;
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.RegulationTypeMapper;
import com.dite.znpt.service.RegulationTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -24,17 +23,20 @@ import java.time.LocalDateTime;
@Service
public class RegulationTypeServiceImpl extends ServiceImpl<RegulationTypeMapper, RegulationTypeEntity> implements RegulationTypeService {
@Autowired
private RegulationMapper regulationMapper;
private final RegulationMapper regulationMapper;
public RegulationTypeServiceImpl(RegulationMapper regulationMapper) {
this.regulationMapper = regulationMapper;
}
@Override
@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 {
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);
} catch (Exception e) {

View File

@ -26,8 +26,10 @@ public class RegulationController {
public Result getRegulationList(@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(required = false) String status,
@RequestParam(required = false) String type) {
return regulationService.getRegulationList(page, size, status, type);
@RequestParam(required = false) String type,
@RequestParam(required = false) String title,
@RequestParam(required = false) String proposer) {
return regulationService.getRegulationList(page, size, status, type, title, proposer);
}
@ApiOperation(value = "创建制度提案", httpMethod = "POST")

View File

@ -25,8 +25,10 @@ public class RegulationTypeController {
@GetMapping
public Result getRegulationTypes(@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(required = false) String typeName) {
return regulationTypeService.getRegulationTypes(page, size, typeName);
@RequestParam(required = false) String typeName,
@RequestParam(required = false) String status,
@RequestParam(required = false) String remark) {
return regulationTypeService.getRegulationTypes(page, size, typeName, status, remark);
}
@ApiOperation(value = "创建制度类型", httpMethod = "POST")