档案借阅文件中间表生成
Showing
12 changed files
with
524 additions
and
0 deletions
1 | package com.pashanhoo.lendfile.controller; | ||
2 | |||
3 | import com.pashanhoo.common.Result; | ||
4 | import com.pashanhoo.lendfile.entity.vo.AddDgLendFileRequest; | ||
5 | import com.pashanhoo.lendfile.entity.vo.UpdateDgLendFileRequest; | ||
6 | import com.pashanhoo.lendfile.entity.vo.DgLendFileSearchRequest; | ||
7 | import com.pashanhoo.lendfile.service.DgLendFileService; | ||
8 | import org.springframework.web.bind.annotation.RestController; | ||
9 | import org.springframework.web.bind.annotation.*; | ||
10 | import io.swagger.annotations.Api; | ||
11 | import io.swagger.annotations.ApiOperation; | ||
12 | import io.swagger.annotations.ApiParam; | ||
13 | import org.springframework.beans.factory.annotation.Autowired; | ||
14 | import java.util.List; | ||
15 | |||
16 | /** | ||
17 | * <p> | ||
18 | * 档案借阅文件 前端控制器 | ||
19 | * </p> | ||
20 | * | ||
21 | * @author | ||
22 | * @since 2021-11-09 | ||
23 | */ | ||
24 | @RestController | ||
25 | @RequestMapping("/system/dgLendFile/") | ||
26 | @Api(tags = "档案借阅文件接口") | ||
27 | public class DgLendFileController { | ||
28 | @Autowired | ||
29 | private DgLendFileService dglendfileService; | ||
30 | |||
31 | @PostMapping("insertDgLendFile") | ||
32 | @ApiOperation("新增档案借阅文件") | ||
33 | public Result insertDgLendFile(@RequestBody AddDgLendFileRequest request){ | ||
34 | if(dglendfileService.insertDgLendFile(request)){ | ||
35 | return Result.ok(); | ||
36 | } | ||
37 | return Result.error("新增失败"); | ||
38 | } | ||
39 | |||
40 | @DeleteMapping("deleteDgLendFileByIds") | ||
41 | @ApiOperation(value = "批量删除档案借阅文件") | ||
42 | public Result deleteDgLendFileByIds(@ApiParam("档案借阅文件ID列表") @RequestParam(value = "idList") List<String> idList) { | ||
43 | if(dglendfileService.removeByIds(idList)) { | ||
44 | return Result.ok("删除成功"); | ||
45 | } | ||
46 | return Result.error("删除失败"); | ||
47 | } | ||
48 | |||
49 | @PutMapping("updateDgLendFile") | ||
50 | @ApiOperation("修改档案借阅文件") | ||
51 | public Result updateDgLendFile(@RequestBody UpdateDgLendFileRequest request){ | ||
52 | if(dglendfileService.updateDgLendFile(request)) { | ||
53 | return Result.ok("修改成功"); | ||
54 | } | ||
55 | return Result.error("修改失败"); | ||
56 | } | ||
57 | |||
58 | @GetMapping("getDgLendFileDetailById") | ||
59 | @ApiOperation(value = "读取明细") | ||
60 | public Result getDgLendFileDetailById(@ApiParam("档案借阅文件ID") @RequestParam String id){ | ||
61 | return Result.ok(dglendfileService.getDgLendFileDetailById(id)); | ||
62 | } | ||
63 | |||
64 | @PostMapping("search") | ||
65 | @ApiOperation(value = "根据条件进行列表查询") | ||
66 | public Result searchDgLendFileList(@RequestBody DgLendFileSearchRequest request) { | ||
67 | //TODO 默认排序条件设置 | ||
68 | request.defaultFillPageProp("",""); | ||
69 | return Result.ok(dglendfileService.searchDgLendFileList(request)); | ||
70 | } | ||
71 | } |
1 | package com.pashanhoo.lendfile.entity; | ||
2 | |||
3 | import java.util.List; | ||
4 | import com.pashanhoo.lendfile.entity.vo.AddDgLendFileRequest; | ||
5 | import com.pashanhoo.lendfile.entity.vo.DgLendFileDetailVO; | ||
6 | import com.pashanhoo.lendfile.entity.vo.DgLendFileListVO; | ||
7 | import com.pashanhoo.lendfile.entity.vo.UpdateDgLendFileRequest; | ||
8 | import org.mapstruct.Mapper; | ||
9 | |||
10 | /** | ||
11 | * @author | ||
12 | * @since 2021-11-09 | ||
13 | */ | ||
14 | @Mapper(componentModel = "spring") | ||
15 | public interface DgLendFileConverter{ | ||
16 | DgLendFileDO addRequest2DO(AddDgLendFileRequest request); | ||
17 | |||
18 | DgLendFileDetailVO do2DetailVO(DgLendFileDO dglendfileDO); | ||
19 | |||
20 | DgLendFileDO updateRequest2DO(UpdateDgLendFileRequest request); | ||
21 | |||
22 | DgLendFileListVO do2ListVO(DgLendFileDO dglendfileDO); | ||
23 | |||
24 | List<DgLendFileListVO> doList2ListVOList(List<DgLendFileDO> dglendfileDOList); | ||
25 | } |
1 | package com.pashanhoo.lendfile.entity; | ||
2 | |||
3 | import com.baomidou.mybatisplus.annotation.TableName; | ||
4 | import com.baomidou.mybatisplus.annotation.IdType; | ||
5 | import com.baomidou.mybatisplus.annotation.TableId; | ||
6 | import com.baomidou.mybatisplus.annotation.TableField; | ||
7 | import java.io.Serializable; | ||
8 | import lombok.Data; | ||
9 | import lombok.EqualsAndHashCode; | ||
10 | |||
11 | /** | ||
12 | * <p> | ||
13 | * 档案借阅文件 | ||
14 | * </p> | ||
15 | * | ||
16 | * @author | ||
17 | * @since 2021-11-09 | ||
18 | */ | ||
19 | @Data | ||
20 | @EqualsAndHashCode(callSuper = false) | ||
21 | @TableName("DG_LEND_FILE") | ||
22 | public class DgLendFileDO implements Serializable { | ||
23 | |||
24 | private static final long serialVersionUID = 1L; | ||
25 | |||
26 | /** | ||
27 | * 借阅文件标识码 | ||
28 | */ | ||
29 | @TableId(value = "BSM_LENDFILE", type = IdType.UUID) | ||
30 | private String bsmLendfile; | ||
31 | |||
32 | /** | ||
33 | * 借阅目录标识码 | ||
34 | */ | ||
35 | @TableField("BSM_LENDCATALOG") | ||
36 | private String bsmLendcatalog; | ||
37 | |||
38 | /** | ||
39 | * 目录标识码 | ||
40 | */ | ||
41 | @TableField("BSM_CATALOG") | ||
42 | private String bsmCatalog; | ||
43 | |||
44 | |||
45 | } |
1 | package com.pashanhoo.lendfile.entity.vo; | ||
2 | |||
3 | import java.io.Serializable; | ||
4 | import io.swagger.annotations.ApiModel; | ||
5 | import io.swagger.annotations.ApiModelProperty; | ||
6 | import lombok.Data; | ||
7 | import lombok.EqualsAndHashCode; | ||
8 | |||
9 | /** | ||
10 | * <p> | ||
11 | * 档案借阅文件新增请求实体 | ||
12 | * </p> | ||
13 | * | ||
14 | * @author | ||
15 | * @since 2021-11-09 | ||
16 | */ | ||
17 | @Data | ||
18 | @EqualsAndHashCode(callSuper = false) | ||
19 | @ApiModel(value="档案借阅文件新增请求实体") | ||
20 | public class AddDgLendFileRequest implements Serializable { | ||
21 | |||
22 | private static final long serialVersionUID = 1L; | ||
23 | |||
24 | |||
25 | /** | ||
26 | * 借阅目录标识码 | ||
27 | */ | ||
28 | @ApiModelProperty(name = "bsmLendcatalog", value = "借阅目录标识码") | ||
29 | private String bsmLendcatalog; | ||
30 | |||
31 | /** | ||
32 | * 目录标识码 | ||
33 | */ | ||
34 | @ApiModelProperty(name = "bsmCatalog", value = "目录标识码") | ||
35 | private String bsmCatalog; | ||
36 | |||
37 | |||
38 | } |
1 | package com.pashanhoo.lendfile.entity.vo; | ||
2 | |||
3 | import com.baomidou.mybatisplus.annotation.TableId; | ||
4 | import com.baomidou.mybatisplus.annotation.TableField; | ||
5 | import java.io.Serializable; | ||
6 | import io.swagger.annotations.ApiModel; | ||
7 | import io.swagger.annotations.ApiModelProperty; | ||
8 | import lombok.Data; | ||
9 | import lombok.EqualsAndHashCode; | ||
10 | |||
11 | /** | ||
12 | * <p> | ||
13 | * 档案借阅文件明细实体 | ||
14 | * </p> | ||
15 | * | ||
16 | * @author | ||
17 | * @since 2021-11-09 | ||
18 | */ | ||
19 | @Data | ||
20 | @EqualsAndHashCode(callSuper = false) | ||
21 | @ApiModel(value="档案借阅文件明细实体") | ||
22 | public class DgLendFileDetailVO implements Serializable { | ||
23 | |||
24 | private static final long serialVersionUID = 1L; | ||
25 | |||
26 | /** | ||
27 | * 借阅文件标识码 | ||
28 | */ | ||
29 | @ApiModelProperty(name = "bsmLendfile", value = "借阅文件标识码") | ||
30 | private String bsmLendfile; | ||
31 | |||
32 | /** | ||
33 | * 借阅目录标识码 | ||
34 | */ | ||
35 | @ApiModelProperty(name = "bsmLendcatalog", value = "借阅目录标识码") | ||
36 | private String bsmLendcatalog; | ||
37 | |||
38 | /** | ||
39 | * 目录标识码 | ||
40 | */ | ||
41 | @ApiModelProperty(name = "bsmCatalog", value = "目录标识码") | ||
42 | private String bsmCatalog; | ||
43 | |||
44 | |||
45 | } |
1 | package com.pashanhoo.lendfile.entity.vo; | ||
2 | |||
3 | import com.baomidou.mybatisplus.annotation.TableId; | ||
4 | import com.baomidou.mybatisplus.annotation.TableField; | ||
5 | import java.io.Serializable; | ||
6 | import io.swagger.annotations.ApiModel; | ||
7 | import io.swagger.annotations.ApiModelProperty; | ||
8 | import lombok.Data; | ||
9 | import lombok.EqualsAndHashCode; | ||
10 | |||
11 | /** | ||
12 | * <p> | ||
13 | * 档案借阅文件列表VO | ||
14 | * </p> | ||
15 | * | ||
16 | * @author | ||
17 | * @since 2021-11-09 | ||
18 | */ | ||
19 | @Data | ||
20 | @EqualsAndHashCode(callSuper = false) | ||
21 | @ApiModel(value="档案借阅文件列表VO") | ||
22 | //TODO 该类属性暂时是完整的全部属性,需进行个性化的增删 | ||
23 | public class DgLendFileListVO implements Serializable { | ||
24 | |||
25 | private static final long serialVersionUID = 1L; | ||
26 | |||
27 | /** | ||
28 | * 借阅文件标识码 | ||
29 | */ | ||
30 | @ApiModelProperty(name = "bsmLendfile", value = "借阅文件标识码") | ||
31 | private String bsmLendfile; | ||
32 | |||
33 | /** | ||
34 | * 借阅目录标识码 | ||
35 | */ | ||
36 | @ApiModelProperty(name = "bsmLendcatalog", value = "借阅目录标识码") | ||
37 | private String bsmLendcatalog; | ||
38 | |||
39 | /** | ||
40 | * 目录标识码 | ||
41 | */ | ||
42 | @ApiModelProperty(name = "bsmCatalog", value = "目录标识码") | ||
43 | private String bsmCatalog; | ||
44 | |||
45 | |||
46 | } |
1 | package com.pashanhoo.lendfile.entity.vo; | ||
2 | |||
3 | import java.io.Serializable; | ||
4 | import io.swagger.annotations.ApiModel; | ||
5 | import io.swagger.annotations.ApiModelProperty; | ||
6 | import lombok.Data; | ||
7 | import lombok.EqualsAndHashCode; | ||
8 | import com.pashanhoo.common.PageInfo; | ||
9 | |||
10 | /** | ||
11 | * <p> | ||
12 | * 档案借阅文件列表查询请求实体 | ||
13 | * </p> | ||
14 | * | ||
15 | * @author | ||
16 | * @since 2021-11-09 | ||
17 | */ | ||
18 | @Data | ||
19 | @EqualsAndHashCode(callSuper = false) | ||
20 | @ApiModel(value="档案借阅文件列表查询请求实体") | ||
21 | //TODO 初始查询条件是全部,需要根据情况自行删减 | ||
22 | public class DgLendFileSearchRequest extends PageInfo implements Serializable { | ||
23 | |||
24 | private static final long serialVersionUID = 1L; | ||
25 | |||
26 | /** | ||
27 | * 借阅文件标识码 | ||
28 | */ | ||
29 | @ApiModelProperty(name = "bsmLendfile", value = "借阅文件标识码") | ||
30 | private String bsmLendfile; | ||
31 | |||
32 | /** | ||
33 | * 借阅目录标识码 | ||
34 | */ | ||
35 | @ApiModelProperty(name = "bsmLendcatalog", value = "借阅目录标识码") | ||
36 | private String bsmLendcatalog; | ||
37 | |||
38 | /** | ||
39 | * 目录标识码 | ||
40 | */ | ||
41 | @ApiModelProperty(name = "bsmCatalog", value = "目录标识码") | ||
42 | private String bsmCatalog; | ||
43 | |||
44 | |||
45 | } |
1 | package com.pashanhoo.lendfile.entity.vo; | ||
2 | |||
3 | import java.io.Serializable; | ||
4 | import io.swagger.annotations.ApiModel; | ||
5 | import io.swagger.annotations.ApiModelProperty; | ||
6 | import lombok.Data; | ||
7 | import lombok.EqualsAndHashCode; | ||
8 | |||
9 | /** | ||
10 | * <p> | ||
11 | * 档案借阅文件修改请求实体 | ||
12 | * </p> | ||
13 | * | ||
14 | * @author | ||
15 | * @since 2021-11-09 | ||
16 | */ | ||
17 | @Data | ||
18 | @EqualsAndHashCode(callSuper = false) | ||
19 | @ApiModel(value="档案借阅文件修改请求实体") | ||
20 | public class UpdateDgLendFileRequest implements Serializable { | ||
21 | |||
22 | private static final long serialVersionUID = 1L; | ||
23 | |||
24 | /** | ||
25 | * 借阅文件标识码 | ||
26 | */ | ||
27 | @ApiModelProperty(name = "bsmLendfile", value = "借阅文件标识码") | ||
28 | private String bsmLendfile; | ||
29 | |||
30 | /** | ||
31 | * 借阅目录标识码 | ||
32 | */ | ||
33 | @ApiModelProperty(name = "bsmLendcatalog", value = "借阅目录标识码") | ||
34 | private String bsmLendcatalog; | ||
35 | |||
36 | /** | ||
37 | * 目录标识码 | ||
38 | */ | ||
39 | @ApiModelProperty(name = "bsmCatalog", value = "目录标识码") | ||
40 | private String bsmCatalog; | ||
41 | |||
42 | |||
43 | } |
1 | package com.pashanhoo.lendfile.mapper; | ||
2 | |||
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | import com.pashanhoo.lendfile.entity.DgLendFileDO; | ||
5 | |||
6 | /** | ||
7 | * <p> | ||
8 | * 档案借阅文件 Mapper 接口 | ||
9 | * </p> | ||
10 | * | ||
11 | * @author | ||
12 | * @since 2021-11-09 | ||
13 | */ | ||
14 | public interface DgLendFileMapper extends BaseMapper<DgLendFileDO> { | ||
15 | |||
16 | } |
1 | package com.pashanhoo.lendfile.service; | ||
2 | |||
3 | import com.baomidou.mybatisplus.extension.service.IService; | ||
4 | import com.pashanhoo.lendfile.entity.DgLendFileDO; | ||
5 | import com.pashanhoo.lendfile.entity.vo.AddDgLendFileRequest; | ||
6 | import com.pashanhoo.lendfile.entity.vo.DgLendFileDetailVO; | ||
7 | import com.pashanhoo.lendfile.entity.vo.UpdateDgLendFileRequest; | ||
8 | import com.pashanhoo.lendfile.entity.vo.DgLendFileSearchRequest; | ||
9 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
10 | |||
11 | /** | ||
12 | * <p> | ||
13 | * 档案借阅文件 服务类 | ||
14 | * </p> | ||
15 | * | ||
16 | * @author | ||
17 | * @since 2021-11-09 | ||
18 | */ | ||
19 | public interface DgLendFileService extends IService<DgLendFileDO> { | ||
20 | /** | ||
21 | * 新增记录 | ||
22 | * @param request | ||
23 | * @return | ||
24 | */ | ||
25 | boolean insertDgLendFile(AddDgLendFileRequest request); | ||
26 | |||
27 | /** | ||
28 | * 根据主键查询记录详情 | ||
29 | * @param id | ||
30 | * @return | ||
31 | */ | ||
32 | DgLendFileDetailVO getDgLendFileDetailById(String id); | ||
33 | |||
34 | /** | ||
35 | * 修改单条记录 | ||
36 | * @param request | ||
37 | * @return | ||
38 | */ | ||
39 | boolean updateDgLendFile(UpdateDgLendFileRequest request); | ||
40 | |||
41 | /** | ||
42 | * 根据条件进行列表查询 | ||
43 | * @param request | ||
44 | * @return | ||
45 | */ | ||
46 | Page searchDgLendFileList(DgLendFileSearchRequest request); | ||
47 | } |
1 | package com.pashanhoo.lendfile.service.impl; | ||
2 | |||
3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
4 | import com.pashanhoo.lendfile.entity.DgLendFileConverter; | ||
5 | import com.pashanhoo.lendfile.entity.DgLendFileDO; | ||
6 | import com.pashanhoo.lendfile.entity.vo.AddDgLendFileRequest; | ||
7 | import com.pashanhoo.lendfile.entity.vo.DgLendFileDetailVO; | ||
8 | import com.pashanhoo.lendfile.entity.vo.UpdateDgLendFileRequest; | ||
9 | import com.pashanhoo.lendfile.entity.vo.DgLendFileSearchRequest; | ||
10 | import com.pashanhoo.lendfile.mapper.DgLendFileMapper; | ||
11 | import com.pashanhoo.lendfile.service.DgLendFileService; | ||
12 | import org.springframework.beans.factory.annotation.Autowired; | ||
13 | import org.springframework.stereotype.Service; | ||
14 | |||
15 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
16 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
17 | |||
18 | /** | ||
19 | * <p> | ||
20 | * 档案借阅文件 服务实现类 | ||
21 | * </p> | ||
22 | * | ||
23 | * @author | ||
24 | * @since 2021-11-09 | ||
25 | */ | ||
26 | @Service | ||
27 | public class DgLendFileServiceImpl extends ServiceImpl<DgLendFileMapper, DgLendFileDO> implements DgLendFileService { | ||
28 | |||
29 | @Autowired | ||
30 | private DgLendFileConverter dglendfileConverter; | ||
31 | |||
32 | @Autowired | ||
33 | private DgLendFileMapper dglendfileMapper; | ||
34 | |||
35 | /** | ||
36 | * 新增记录 | ||
37 | * @param request | ||
38 | * @return | ||
39 | */ | ||
40 | @Override | ||
41 | public boolean insertDgLendFile(AddDgLendFileRequest request) { | ||
42 | DgLendFileDO dglendfileDO = dglendfileConverter.addRequest2DO(request); | ||
43 | return this.save(dglendfileDO); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * 根据主键查询记录详情 | ||
48 | * @param id | ||
49 | * @return | ||
50 | */ | ||
51 | @Override | ||
52 | public DgLendFileDetailVO getDgLendFileDetailById(String id) { | ||
53 | DgLendFileDO dglendfileDO = this.getById(id); | ||
54 | return dglendfileConverter.do2DetailVO(dglendfileDO); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * 修改单条记录 | ||
59 | * @param request | ||
60 | * @return | ||
61 | */ | ||
62 | @Override | ||
63 | public boolean updateDgLendFile(UpdateDgLendFileRequest request) { | ||
64 | DgLendFileDO dglendfileDO = dglendfileConverter.updateRequest2DO(request); | ||
65 | return this.updateById(dglendfileDO); | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * 根据条件进行列表查询 | ||
70 | * @param request | ||
71 | * @return | ||
72 | */ | ||
73 | @Override | ||
74 | public Page searchDgLendFileList(DgLendFileSearchRequest request) { | ||
75 | Page<DgLendFileDO> pageParam = new Page<DgLendFileDO>(request.getCurrentPage(), request.getPageSize()); | ||
76 | QueryWrapper<DgLendFileDO> wrapper = new QueryWrapper<>(); | ||
77 | //设置默认排序 | ||
78 | wrapper = "desc".equals(request.getSortOrder()) ? wrapper.orderByDesc(request.getSortField()) : wrapper.orderByAsc(request.getSortField()); | ||
79 | |||
80 | //TODO 根据当前情况设置wrapper条件 | ||
81 | |||
82 | Page page = this.page(pageParam, wrapper); | ||
83 | //将查询出来的DO List转为 ListVO List并重新设置到page对象中,并返回page对象 | ||
84 | return page.setRecords(dglendfileConverter.doList2ListVOList(page.getRecords())); | ||
85 | } | ||
86 | |||
87 | } |
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | <mapper namespace="com.pashanhoo.lendfile.mapper.DgLendFileMapper"> | ||
4 | |||
5 | <!-- 通用查询映射结果 --> | ||
6 | <resultMap id="BaseResultMap" type="com.pashanhoo.lendfile.entity.DgLendFileDO"> | ||
7 | <id column="BSM_LENDFILE" property="bsmLendfile" /> | ||
8 | <result column="BSM_LENDCATALOG" property="bsmLendcatalog" /> | ||
9 | <result column="BSM_CATALOG" property="bsmCatalog" /> | ||
10 | </resultMap> | ||
11 | |||
12 | <!-- 通用查询结果列 --> | ||
13 | <sql id="Base_Column_List"> | ||
14 | BSM_LENDFILE, BSM_LENDCATALOG, BSM_CATALOG | ||
15 | </sql> | ||
16 | </mapper> |
-
Please register or sign in to post a comment