Commit 6ad04deec69e06b0af24a267d7669abd55c83a50
1 parent
c22f4db5
添加表格、公司
Showing
20 changed files
with
907 additions
and
1 deletions
src/main/java/com/huaheng/pc/config/containerType/controller/ContainerTypeController.java
... | ... | @@ -65,7 +65,7 @@ public class ContainerTypeController extends BaseController |
65 | 65 | .eq(ContainerType::getWarehouseCode,ShiroUtils.getWarehouseCode()) |
66 | 66 | .in(ContainerType::getCompanyCode,ShiroUtils.getCompanyCodeList()) |
67 | 67 | .eq(StringUtils.isNotEmpty(containerType.getCode()),ContainerType::getCode,containerType.getCode()) |
68 | - .like(StringUtils.isNotEmpty(containerType.getName()),ContainerType::getName,containerType.getName());; | |
68 | + .like(StringUtils.isNotEmpty(containerType.getName()),ContainerType::getName,containerType.getName()); | |
69 | 69 | |
70 | 70 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ |
71 | 71 | /** |
... | ... |
src/main/java/com/huaheng/pc/config/corporation/controller/CorporationController.java
0 → 100644
1 | +package com.huaheng.pc.config.corporation.controller; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
7 | +import com.huaheng.common.support.Convert; | |
8 | +import com.huaheng.common.utils.StringUtils; | |
9 | +import com.huaheng.common.utils.security.ShiroUtils; | |
10 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | |
11 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | |
12 | +import com.huaheng.framework.web.controller.BaseController; | |
13 | +import com.huaheng.framework.web.domain.AjaxResult; | |
14 | +import com.huaheng.framework.web.page.PageDomain; | |
15 | +import com.huaheng.framework.web.page.TableDataInfo; | |
16 | +import com.huaheng.framework.web.page.TableSupport; | |
17 | +import com.huaheng.pc.config.corporation.domain.Corporation; | |
18 | +import com.huaheng.pc.config.corporation.service.CorporationService; | |
19 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
20 | +import org.springframework.stereotype.Controller; | |
21 | +import org.springframework.ui.ModelMap; | |
22 | +import org.springframework.web.bind.annotation.*; | |
23 | + | |
24 | +import javax.annotation.Resource; | |
25 | +import java.util.Arrays; | |
26 | +import java.util.List; | |
27 | + | |
28 | +/** | |
29 | + * 公司 控制处理类 | |
30 | + * | |
31 | + * @author Enzo Cotter | |
32 | + * @date 2020/3/20 | |
33 | + */ | |
34 | +@Controller | |
35 | +@RequestMapping("/config/corporation") | |
36 | +public class CorporationController extends BaseController { | |
37 | + | |
38 | + @Resource | |
39 | + private CorporationService corporationService; | |
40 | + | |
41 | + private String prefix = "/config/corporation"; | |
42 | + | |
43 | + @RequiresPermissions("config:corporation:view") | |
44 | + @GetMapping() | |
45 | + public String corporation() { | |
46 | + return prefix + "/corporation"; | |
47 | + } | |
48 | + | |
49 | + /** | |
50 | + * 查询公司列表 | |
51 | + */ | |
52 | + @RequiresPermissions("config:corporation:list") | |
53 | + @Log(title = "配置-公司", operating = "查看公司", action = BusinessType.GRANT) | |
54 | + @PostMapping("/list") | |
55 | + @ResponseBody | |
56 | + public TableDataInfo list(Corporation corporation, String createdBegin, String createdEnd) { | |
57 | + LambdaQueryWrapper<Corporation> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
58 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | |
59 | + Integer pageNum = pageDomain.getPageNum(); | |
60 | + Integer pageSize = pageDomain.getPageSize(); | |
61 | + | |
62 | + lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), Corporation::getCreated, createdBegin) | |
63 | + .le(StringUtils.isNotEmpty(createdEnd), Corporation::getCreated, createdEnd) | |
64 | + .like(StringUtils.isNotEmpty(corporation.getAddress()), Corporation::getAddress, corporation.getAddress()) | |
65 | + .like(StringUtils.isNotEmpty(corporation.getName()), Corporation::getName, corporation.getName()); | |
66 | + | |
67 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | |
68 | + /** | |
69 | + * 使用分页查询 | |
70 | + */ | |
71 | + Page<Corporation> page = new Page<>(pageNum, pageSize); | |
72 | + IPage<Corporation> iPage = corporationService.page(page, lambdaQueryWrapper); | |
73 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
74 | + } else { | |
75 | + List<Corporation> list = corporationService.list(lambdaQueryWrapper); | |
76 | + return getDataTable(list); | |
77 | + } | |
78 | + } | |
79 | + | |
80 | + /** | |
81 | + * 新增公司 | |
82 | + */ | |
83 | + @GetMapping("/add") | |
84 | + public String add() { | |
85 | + return prefix + "/add"; | |
86 | + } | |
87 | + | |
88 | + /** | |
89 | + * 新增保存公司 | |
90 | + */ | |
91 | + @RequiresPermissions("config:corporation:add") | |
92 | + @Log(title = "配置-容器类型设置", operating = "新增容器类型", action = BusinessType.INSERT) | |
93 | + @PostMapping("/add") | |
94 | + @ResponseBody | |
95 | + public AjaxResult addSave(Corporation corporation) { | |
96 | + corporation.setCreateBy(ShiroUtils.getLoginName()); | |
97 | + corporation.setCreateBy(ShiroUtils.getLoginName()); | |
98 | + return toAjax(corporationService.save(corporation)); | |
99 | + } | |
100 | + | |
101 | + /** | |
102 | + * 修改公司 | |
103 | + */ | |
104 | + @GetMapping("/edit/{id}") | |
105 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | |
106 | + mmap.put("corporation", corporationService.getById(id)); | |
107 | + return prefix + "/edit"; | |
108 | + } | |
109 | + | |
110 | + /** | |
111 | + * 修改保存公司 | |
112 | + */ | |
113 | + @RequiresPermissions("config:corporation:edit") | |
114 | + @Log(title = "配置-公司", operating = "修改公司", action = BusinessType.UPDATE) | |
115 | + @PostMapping("/edit") | |
116 | + @ResponseBody | |
117 | + public AjaxResult editSave(Corporation corporation) { | |
118 | + return toAjax(corporationService.saveOrUpdate(corporation)); | |
119 | + } | |
120 | + | |
121 | + /** | |
122 | + * 删除公司 | |
123 | + */ | |
124 | + @RequiresPermissions("config:corporation:remove") | |
125 | + @Log(title = "配置-公司", operating = "删除公司", action = BusinessType.DELETE) | |
126 | + @PostMapping("/remove") | |
127 | + @ResponseBody | |
128 | + public AjaxResult remove(String ids) { | |
129 | + if (StringUtils.isEmpty(ids)) { | |
130 | + return AjaxResult.error("id不能为空"); | |
131 | + } | |
132 | + return toAjax(corporationService.removeByIds(Arrays.asList(Convert.toIntArray(ids)))); | |
133 | + } | |
134 | +} | |
... | ... |
src/main/java/com/huaheng/pc/config/corporation/domain/Corporation.java
0 → 100644
1 | +package com.huaheng.pc.config.corporation.domain; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import java.io.Serializable; | |
8 | +import java.util.Date; | |
9 | +import lombok.Data; | |
10 | + | |
11 | +/** | |
12 | + * Created by Enzo Cotter on 2020/3/20. | |
13 | + */ | |
14 | + | |
15 | +@Data | |
16 | +@TableName(value = "corporation") | |
17 | +public class Corporation implements Serializable { | |
18 | + @TableId(value = "id", type = IdType.AUTO) | |
19 | + private Long id; | |
20 | + | |
21 | + /** | |
22 | + * 公司名称 | |
23 | + */ | |
24 | + @TableField(value = "name") | |
25 | + private String name; | |
26 | + | |
27 | + /** | |
28 | + * logo | |
29 | + */ | |
30 | + @TableField(value = "logo") | |
31 | + private String logo; | |
32 | + | |
33 | + /** | |
34 | + * 地址 | |
35 | + */ | |
36 | + @TableField(value = "address") | |
37 | + private String address; | |
38 | + | |
39 | + /** | |
40 | + * 创建时间 | |
41 | + */ | |
42 | + @TableField(value = "created") | |
43 | + private Date created; | |
44 | + | |
45 | + /** | |
46 | + * 创建人 | |
47 | + */ | |
48 | + @TableField(value = "create_by") | |
49 | + private String createBy; | |
50 | + | |
51 | + private static final long serialVersionUID = 1L; | |
52 | +} | |
0 | 53 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/config/corporation/mapper/CorporationMapper.java
0 → 100644
1 | +package com.huaheng.pc.config.corporation.mapper; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | +import com.huaheng.pc.config.corporation.domain.Corporation; | |
5 | + | |
6 | +/** | |
7 | + * Created by Enzo Cotter on 2020/3/20. | |
8 | + */ | |
9 | + | |
10 | +public interface CorporationMapper extends BaseMapper<Corporation> { | |
11 | +} | |
0 | 12 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/config/corporation/service/CorporationService.java
0 → 100644
1 | +package com.huaheng.pc.config.corporation.service; | |
2 | + | |
3 | +import com.huaheng.pc.config.corporation.domain.Corporation; | |
4 | +import com.baomidou.mybatisplus.extension.service.IService; | |
5 | + /** | |
6 | + * Created by Enzo Cotter on 2020/3/20. | |
7 | + */ | |
8 | + | |
9 | +public interface CorporationService extends IService<Corporation>{ | |
10 | + | |
11 | + | |
12 | +} | |
... | ... |
src/main/java/com/huaheng/pc/config/corporation/service/impl/CorporationServiceImpl.java
0 → 100644
1 | +package com.huaheng.pc.config.corporation.service.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Service; | |
4 | +import javax.annotation.Resource; | |
5 | +import java.util.List; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import com.huaheng.pc.config.corporation.mapper.CorporationMapper; | |
8 | +import com.huaheng.pc.config.corporation.domain.Corporation; | |
9 | +import com.huaheng.pc.config.corporation.service.CorporationService; | |
10 | +/** | |
11 | + * Created by Enzo Cotter on 2020/3/20. | |
12 | + */ | |
13 | + | |
14 | +@Service | |
15 | +public class CorporationServiceImpl extends ServiceImpl<CorporationMapper, Corporation> implements CorporationService{ | |
16 | + | |
17 | +} | |
... | ... |
src/main/java/com/huaheng/pc/system/systable/controller/SysTableFieldInfoController.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.controller; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
7 | +import com.huaheng.common.support.Convert; | |
8 | +import com.huaheng.common.utils.StringUtils; | |
9 | +import com.huaheng.common.utils.security.ShiroUtils; | |
10 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | |
11 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | |
12 | +import com.huaheng.framework.web.controller.BaseController; | |
13 | +import com.huaheng.framework.web.domain.AjaxResult; | |
14 | +import com.huaheng.framework.web.page.PageDomain; | |
15 | +import com.huaheng.framework.web.page.TableDataInfo; | |
16 | +import com.huaheng.framework.web.page.TableSupport; | |
17 | +import com.huaheng.pc.system.systable.domain.SysTableFieldInfo; | |
18 | +import com.huaheng.pc.system.systable.service.SysTableFieldInfoService; | |
19 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
20 | +import org.springframework.stereotype.Controller; | |
21 | +import org.springframework.ui.ModelMap; | |
22 | +import org.springframework.web.bind.annotation.*; | |
23 | + | |
24 | +import javax.annotation.Resource; | |
25 | +import java.util.Arrays; | |
26 | +import java.util.Date; | |
27 | +import java.util.List; | |
28 | + | |
29 | +/** | |
30 | + * Created by Enzo Cotter on 2020/3/20. | |
31 | + */ | |
32 | + | |
33 | +@Controller | |
34 | +@RequestMapping("/system/tableFieldInfo") | |
35 | +public class SysTableFieldInfoController extends BaseController { | |
36 | + | |
37 | + @Resource | |
38 | + private SysTableFieldInfoService tableFieldInfoService; | |
39 | + | |
40 | + private String prefix = "/system/table"; | |
41 | + | |
42 | + @RequiresPermissions("system:table:view") | |
43 | + @GetMapping() | |
44 | + public String sysTableFieldInfo() { | |
45 | + return prefix + "/table"; | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * 查询表格字段列表 | |
50 | + */ | |
51 | + @RequiresPermissions("system:table:list") | |
52 | + @Log(title = "系统-表格字段", operating = "查看表格字段", action = BusinessType.GRANT) | |
53 | + @PostMapping("/list") | |
54 | + @ResponseBody | |
55 | + public TableDataInfo list(SysTableFieldInfo sysTableFieldInfo, String createdBegin, String createdEnd) { | |
56 | + LambdaQueryWrapper<SysTableFieldInfo> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
57 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | |
58 | + Integer pageNum = pageDomain.getPageNum(); | |
59 | + Integer pageSize = pageDomain.getPageSize(); | |
60 | + | |
61 | + lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), SysTableFieldInfo::getCreated, createdBegin) | |
62 | + .le(StringUtils.isNotEmpty(createdEnd), SysTableFieldInfo::getCreated, createdEnd) | |
63 | + .like(StringUtils.isNotNull(sysTableFieldInfo.getHeadId()), SysTableFieldInfo::getHeadId, sysTableFieldInfo.getHeadId()) | |
64 | + .like(StringUtils.isNotEmpty(sysTableFieldInfo.getFieldCode()), SysTableFieldInfo::getFieldCode, sysTableFieldInfo.getFieldCode()) | |
65 | + .eq(StringUtils.isNotEmpty(sysTableFieldInfo.getFiledName()), SysTableFieldInfo::getFiledName, sysTableFieldInfo.getFiledName()) | |
66 | + .eq(StringUtils.isNotEmpty(sysTableFieldInfo.getFiledFuncation()),SysTableFieldInfo::getFiledFuncation, sysTableFieldInfo.getFiledFuncation()); | |
67 | + | |
68 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | |
69 | + /** | |
70 | + * 使用分页查询 | |
71 | + */ | |
72 | + Page<SysTableFieldInfo> page = new Page<>(pageNum, pageSize); | |
73 | + IPage<SysTableFieldInfo> iPage = tableFieldInfoService.page(page, lambdaQueryWrapper); | |
74 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
75 | + } else { | |
76 | + List<SysTableFieldInfo> list = tableFieldInfoService.list(lambdaQueryWrapper); | |
77 | + return getDataTable(list); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * 新增表格字段 | |
83 | + */ | |
84 | + @GetMapping("/add") | |
85 | + public String add() { | |
86 | + return prefix + "/add"; | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 新增保存表格字段 | |
91 | + */ | |
92 | + @RequiresPermissions("system:table:add") | |
93 | + @Log(title = "系统-表格字段", operating = "表格字段", action = BusinessType.INSERT) | |
94 | + @PostMapping("/add") | |
95 | + @ResponseBody | |
96 | + public AjaxResult addSave(SysTableFieldInfo sysTableFieldInfo) { | |
97 | + sysTableFieldInfo.setCreated(new Date()); | |
98 | + sysTableFieldInfo.setCreatedBy(ShiroUtils.getLoginName()); | |
99 | + sysTableFieldInfo.setLastUpdated(new Date()); | |
100 | + sysTableFieldInfo.setLastUpdateBy(ShiroUtils.getLoginName()); | |
101 | + return toAjax(tableFieldInfoService.save(sysTableFieldInfo)); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * 修改表格字段 | |
106 | + */ | |
107 | + @GetMapping("/edit/{id}") | |
108 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | |
109 | + mmap.put("sysTableFieldInfo", tableFieldInfoService.getById(id)); | |
110 | + return prefix + "/edit"; | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * 修改保存表格字段 | |
115 | + */ | |
116 | + @RequiresPermissions("system:sysTableFieldInfo:edit") | |
117 | + @Log(title = "系统-表格字段", operating = "修改表格字段", action = BusinessType.UPDATE) | |
118 | + @PostMapping("/edit") | |
119 | + @ResponseBody | |
120 | + public AjaxResult editSave(SysTableFieldInfo sysTableFieldInfo) { | |
121 | + sysTableFieldInfo.setLastUpdated(new Date()); | |
122 | + sysTableFieldInfo.setLastUpdateBy(ShiroUtils.getLoginName()); | |
123 | + return toAjax(tableFieldInfoService.saveOrUpdate(sysTableFieldInfo)); | |
124 | + } | |
125 | + | |
126 | + /** | |
127 | + * 删除表格字段 | |
128 | + */ | |
129 | + @RequiresPermissions("system:table:remove") | |
130 | + @Log(title = "系统-表格字段", operating = "删除表格字段", action = BusinessType.DELETE) | |
131 | + @PostMapping("/remove") | |
132 | + @ResponseBody | |
133 | + public AjaxResult remove(String ids) { | |
134 | + if (StringUtils.isEmpty(ids)) { | |
135 | + return AjaxResult.error("id不能为空"); | |
136 | + } | |
137 | + return toAjax(tableFieldInfoService.removeByIds(Arrays.asList(Convert.toIntArray(ids)))); | |
138 | + } | |
139 | + | |
140 | +} | |
... | ... |
src/main/java/com/huaheng/pc/system/systable/controller/SysTableInfoController.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.controller; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
7 | +import com.huaheng.common.support.Convert; | |
8 | +import com.huaheng.common.utils.StringUtils; | |
9 | +import com.huaheng.common.utils.security.ShiroUtils; | |
10 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | |
11 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | |
12 | +import com.huaheng.framework.web.controller.BaseController; | |
13 | +import com.huaheng.framework.web.domain.AjaxResult; | |
14 | +import com.huaheng.framework.web.page.PageDomain; | |
15 | +import com.huaheng.framework.web.page.TableDataInfo; | |
16 | +import com.huaheng.framework.web.page.TableSupport; | |
17 | +import com.huaheng.pc.system.systable.domain.SysTableInfo; | |
18 | +import com.huaheng.pc.system.systable.service.SysTableInfoService; | |
19 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
20 | +import org.springframework.stereotype.Controller; | |
21 | +import org.springframework.ui.ModelMap; | |
22 | +import org.springframework.web.bind.annotation.*; | |
23 | + | |
24 | +import javax.annotation.Resource; | |
25 | +import java.util.Arrays; | |
26 | +import java.util.Date; | |
27 | +import java.util.List; | |
28 | + | |
29 | +/** | |
30 | + * Created by Enzo Cotter on 2020/3/20. | |
31 | + */ | |
32 | +@Controller | |
33 | +@RequestMapping("/system/tableInfo") | |
34 | +public class SysTableInfoController extends BaseController { | |
35 | + | |
36 | + @Resource | |
37 | + private SysTableInfoService sysTableInfoService; | |
38 | + | |
39 | + private String prefix = "/system/table"; | |
40 | + | |
41 | + @RequiresPermissions("system:table:view") | |
42 | + @GetMapping() | |
43 | + public String sysTableInfo() { | |
44 | + return prefix + "/table"; | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * 查询表格列表 | |
49 | + */ | |
50 | + @RequiresPermissions("system:table:list") | |
51 | + @Log(title = "系统-表格", operating = "查看表格", action = BusinessType.GRANT) | |
52 | + @PostMapping("/list") | |
53 | + @ResponseBody | |
54 | + public TableDataInfo list(SysTableInfo sysTableInfo, String createdBegin, String createdEnd) { | |
55 | + LambdaQueryWrapper<SysTableInfo> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
56 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | |
57 | + Integer pageNum = pageDomain.getPageNum(); | |
58 | + Integer pageSize = pageDomain.getPageSize(); | |
59 | + | |
60 | + lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), SysTableInfo::getCreated, createdBegin) | |
61 | + .le(StringUtils.isNotEmpty(createdEnd), SysTableInfo::getCreated, createdEnd) | |
62 | + .like(StringUtils.isNotEmpty(sysTableInfo.getTableCode()), SysTableInfo::getTableCode, sysTableInfo.getTableCode()) | |
63 | + .like(StringUtils.isNotEmpty(sysTableInfo.getTableName()), SysTableInfo::getTableName, sysTableInfo.getTableName()) | |
64 | + .eq(StringUtils.isNotEmpty(sysTableInfo.getWarehouseCode()), SysTableInfo::getWarehouseCode, sysTableInfo.getWarehouseCode()); | |
65 | + | |
66 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | |
67 | + /** | |
68 | + * 使用分页查询 | |
69 | + */ | |
70 | + Page<SysTableInfo> page = new Page<>(pageNum, pageSize); | |
71 | + IPage<SysTableInfo> iPage = sysTableInfoService.page(page, lambdaQueryWrapper); | |
72 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
73 | + } else { | |
74 | + List<SysTableInfo> list = sysTableInfoService.list(lambdaQueryWrapper); | |
75 | + return getDataTable(list); | |
76 | + } | |
77 | + } | |
78 | + | |
79 | + /** | |
80 | + * 新增表格 | |
81 | + */ | |
82 | + @GetMapping("/add") | |
83 | + public String add() { | |
84 | + return prefix + "/add"; | |
85 | + } | |
86 | + | |
87 | + /** | |
88 | + * 新增保存表格 | |
89 | + */ | |
90 | + @RequiresPermissions("system:table:add") | |
91 | + @Log(title = "系统-表格", operating = "新增表格", action = BusinessType.INSERT) | |
92 | + @PostMapping("/add") | |
93 | + @ResponseBody | |
94 | + public AjaxResult addSave(SysTableInfo sysTableInfo) { | |
95 | + sysTableInfo.setCreated(new Date()); | |
96 | + sysTableInfo.setCreatedBy(ShiroUtils.getLoginName()); | |
97 | + sysTableInfo.setLastUpdated(new Date()); | |
98 | + sysTableInfo.setLastUpdateBy(ShiroUtils.getLoginName()); | |
99 | + return toAjax(sysTableInfoService.save(sysTableInfo)); | |
100 | + } | |
101 | + | |
102 | + /** | |
103 | + * 修改表格 | |
104 | + */ | |
105 | + @GetMapping("/edit/{id}") | |
106 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | |
107 | + mmap.put("sysTableInfo", sysTableInfoService.getById(id)); | |
108 | + return prefix + "/edit"; | |
109 | + } | |
110 | + | |
111 | + /** | |
112 | + * 修改保存表格 | |
113 | + */ | |
114 | + @RequiresPermissions("system:table:edit") | |
115 | + @Log(title = "系统-表格", operating = "修改表格", action = BusinessType.UPDATE) | |
116 | + @PostMapping("/edit") | |
117 | + @ResponseBody | |
118 | + public AjaxResult editSave(SysTableInfo sysTableInfo) { | |
119 | + sysTableInfo.setLastUpdated(new Date()); | |
120 | + sysTableInfo.setLastUpdateBy(ShiroUtils.getLoginName()); | |
121 | + return toAjax(sysTableInfoService.saveOrUpdate(sysTableInfo)); | |
122 | + } | |
123 | + | |
124 | + /** | |
125 | + * 删除表格 | |
126 | + */ | |
127 | + @RequiresPermissions("system:table:remove") | |
128 | + @Log(title = "系统-表格", operating = "修改表格", action = BusinessType.DELETE) | |
129 | + @PostMapping("/remove") | |
130 | + @ResponseBody | |
131 | + public AjaxResult remove(String ids) { | |
132 | + if (StringUtils.isEmpty(ids)) { | |
133 | + return AjaxResult.error("id不能为空"); | |
134 | + } | |
135 | + return toAjax(sysTableInfoService.removeByIds(Arrays.asList(Convert.toIntArray(ids)))); | |
136 | + } | |
137 | +} | |
0 | 138 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/system/systable/domain/SysTableFieldInfo.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.domain; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import java.io.Serializable; | |
8 | +import java.util.Date; | |
9 | +import lombok.Data; | |
10 | + | |
11 | +/** | |
12 | + * Created by Enzo Cotter on 2020/3/21. | |
13 | + */ | |
14 | + | |
15 | +@Data | |
16 | +@TableName(value = "sys_table_field_info") | |
17 | +public class SysTableFieldInfo implements Serializable { | |
18 | + @TableId(value = "id", type = IdType.AUTO) | |
19 | + private Long id; | |
20 | + | |
21 | + /** | |
22 | + * sys_table_info的主键标识 | |
23 | + */ | |
24 | + @TableField(value = "head_id") | |
25 | + private Long headId; | |
26 | + | |
27 | + /** | |
28 | + * 字段名称 | |
29 | + */ | |
30 | + @TableField(value = "field_code") | |
31 | + private String fieldCode; | |
32 | + | |
33 | + /** | |
34 | + * 字段的中文名称 | |
35 | + */ | |
36 | + @TableField(value = "filed_name") | |
37 | + private String filedName; | |
38 | + | |
39 | + /** | |
40 | + * 字段设计的使用说明 | |
41 | + */ | |
42 | + @TableField(value = "filed_funcation") | |
43 | + private String filedFuncation; | |
44 | + | |
45 | + @TableField(value = "created") | |
46 | + private Date created; | |
47 | + | |
48 | + @TableField(value = "created_by") | |
49 | + private String createdBy; | |
50 | + | |
51 | + @TableField(value = "last_updated") | |
52 | + private Date lastUpdated; | |
53 | + | |
54 | + @TableField(value = "last_update_by") | |
55 | + private String lastUpdateBy; | |
56 | + | |
57 | + private static final long serialVersionUID = 1L; | |
58 | +} | |
0 | 59 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/system/systable/domain/SysTableInfo.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.domain; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import java.io.Serializable; | |
8 | +import java.util.Date; | |
9 | +import lombok.Data; | |
10 | + | |
11 | +/** | |
12 | + * Created by Enzo Cotter on 2020/3/20. | |
13 | + */ | |
14 | + | |
15 | +@Data | |
16 | +@TableName(value = "sys_table_info") | |
17 | +public class SysTableInfo implements Serializable { | |
18 | + @TableId(value = "id", type = IdType.AUTO) | |
19 | + private Long id; | |
20 | + | |
21 | + /** | |
22 | + * 仓库编码 | |
23 | + */ | |
24 | + @TableField(value = "warehouse_code") | |
25 | + private String warehouseCode; | |
26 | + | |
27 | + /** | |
28 | + * 表对应的名称 | |
29 | + */ | |
30 | + @TableField(value = "table_code") | |
31 | + private String tableCode; | |
32 | + | |
33 | + /** | |
34 | + * 表对应的中文名称 | |
35 | + */ | |
36 | + @TableField(value = "table_name") | |
37 | + private String tableName; | |
38 | + | |
39 | + /** | |
40 | + * 表设计的功能说明 | |
41 | + */ | |
42 | + @TableField(value = "table_funcation") | |
43 | + private String tableFuncation; | |
44 | + | |
45 | + /** | |
46 | + * 创建时间 | |
47 | + */ | |
48 | + @TableField(value = "created") | |
49 | + private Date created; | |
50 | + | |
51 | + /** | |
52 | + * 创建人 | |
53 | + */ | |
54 | + @TableField(value = "created_by") | |
55 | + private String createdBy; | |
56 | + | |
57 | + /** | |
58 | + * 更新时间 | |
59 | + */ | |
60 | + @TableField(value = "last_updated") | |
61 | + private Date lastUpdated; | |
62 | + | |
63 | + /** | |
64 | + * 更新人 | |
65 | + */ | |
66 | + @TableField(value = "last_update_by") | |
67 | + private String lastUpdateBy; | |
68 | + | |
69 | + private static final long serialVersionUID = 1L; | |
70 | +} | |
0 | 71 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/system/systable/mapper/SysTableFieldInfoMapper.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.mapper; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | +import com.huaheng.pc.system.systable.domain.SysTableFieldInfo; | |
5 | + | |
6 | +/** | |
7 | + * Created by Enzo Cotter on 2020/3/21. | |
8 | + */ | |
9 | + | |
10 | +public interface SysTableFieldInfoMapper extends BaseMapper<SysTableFieldInfo> { | |
11 | +} | |
0 | 12 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/system/systable/mapper/SysTableInfoMapper.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.mapper; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | +import com.huaheng.pc.system.systable.domain.SysTableInfo; | |
5 | + | |
6 | +/** | |
7 | + * Created by Enzo Cotter on 2020/3/20. | |
8 | + */ | |
9 | + | |
10 | +public interface SysTableInfoMapper extends BaseMapper<SysTableInfo> { | |
11 | +} | |
0 | 12 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/system/systable/service/SysTableFieldInfoService.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.service; | |
2 | + | |
3 | +import com.huaheng.pc.system.systable.domain.SysTableFieldInfo; | |
4 | +import com.baomidou.mybatisplus.extension.service.IService; | |
5 | + /** | |
6 | + * Created by Enzo Cotter on 2020/3/21. | |
7 | + */ | |
8 | + | |
9 | +public interface SysTableFieldInfoService extends IService<SysTableFieldInfo>{ | |
10 | + | |
11 | + | |
12 | +} | |
... | ... |
src/main/java/com/huaheng/pc/system/systable/service/SysTableInfoService.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.service; | |
2 | + | |
3 | +import com.huaheng.pc.system.systable.domain.SysTableInfo; | |
4 | +import com.baomidou.mybatisplus.extension.service.IService; | |
5 | + /** | |
6 | + * Created by Enzo Cotter on 2020/3/20. | |
7 | + */ | |
8 | + | |
9 | +public interface SysTableInfoService extends IService<SysTableInfo>{ | |
10 | + | |
11 | + | |
12 | +} | |
... | ... |
src/main/java/com/huaheng/pc/system/systable/service/impl/SysTableFieldInfoServiceImpl.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.service.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Service; | |
4 | +import javax.annotation.Resource; | |
5 | +import java.util.List; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import com.huaheng.pc.system.systable.mapper.SysTableFieldInfoMapper; | |
8 | +import com.huaheng.pc.system.systable.domain.SysTableFieldInfo; | |
9 | +import com.huaheng.pc.system.systable.service.SysTableFieldInfoService; | |
10 | +/** | |
11 | + * Created by Enzo Cotter on 2020/3/21. | |
12 | + */ | |
13 | + | |
14 | +@Service | |
15 | +public class SysTableFieldInfoServiceImpl extends ServiceImpl<SysTableFieldInfoMapper, SysTableFieldInfo> implements SysTableFieldInfoService{ | |
16 | + | |
17 | +} | |
... | ... |
src/main/java/com/huaheng/pc/system/systable/service/impl/SysTableInfoServiceImpl.java
0 → 100644
1 | +package com.huaheng.pc.system.systable.service.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Service; | |
4 | +import javax.annotation.Resource; | |
5 | +import java.util.List; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import com.huaheng.pc.system.systable.domain.SysTableInfo; | |
8 | +import com.huaheng.pc.system.systable.mapper.SysTableInfoMapper; | |
9 | +import com.huaheng.pc.system.systable.service.SysTableInfoService; | |
10 | +/** | |
11 | + * Created by Enzo Cotter on 2020/3/20. | |
12 | + */ | |
13 | + | |
14 | +@Service | |
15 | +public class SysTableInfoServiceImpl extends ServiceImpl<SysTableInfoMapper, SysTableInfo> implements SysTableInfoService{ | |
16 | + | |
17 | +} | |
... | ... |
src/main/resources/mybatis/config/CorporationMapper.xml
0 → 100644
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.huaheng.pc.config.corporation.mapper.CorporationMapper"> | |
4 | + <resultMap id="BaseResultMap" type="com.huaheng.pc.config.corporation.domain.Corporation"> | |
5 | + <!--@mbg.generated--> | |
6 | + <!--@Table corporation--> | |
7 | + <id column="id" jdbcType="BIGINT" property="id" /> | |
8 | + <result column="name" jdbcType="VARCHAR" property="name" /> | |
9 | + <result column="logo" jdbcType="VARCHAR" property="logo" /> | |
10 | + <result column="address" jdbcType="VARCHAR" property="address" /> | |
11 | + <result column="created" jdbcType="TIMESTAMP" property="created" /> | |
12 | + <result column="create_by" jdbcType="VARCHAR" property="createBy" /> | |
13 | + </resultMap> | |
14 | + <sql id="Base_Column_List"> | |
15 | + <!--@mbg.generated--> | |
16 | + id, `name`, logo, address, created, create_by | |
17 | + </sql> | |
18 | +</mapper> | |
0 | 19 | \ No newline at end of file |
... | ... |
src/main/resources/mybatis/system/SysTableFieldInfoMapper.xml
0 → 100644
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.huaheng.pc.system.systable.mapper.SysTableFieldInfoMapper"> | |
4 | + <resultMap id="BaseResultMap" type="com.huaheng.pc.system.systable.domain.SysTableFieldInfo"> | |
5 | + <!--@mbg.generated--> | |
6 | + <!--@Table sys_table_field_info--> | |
7 | + <id column="id" jdbcType="BIGINT" property="id" /> | |
8 | + <result column="head_id" jdbcType="BIGINT" property="headId" /> | |
9 | + <result column="field_code" jdbcType="VARCHAR" property="fieldCode" /> | |
10 | + <result column="filed_name" jdbcType="VARCHAR" property="filedName" /> | |
11 | + <result column="filed_funcation" jdbcType="VARCHAR" property="filedFuncation" /> | |
12 | + <result column="created" jdbcType="TIMESTAMP" property="created" /> | |
13 | + <result column="created_by" jdbcType="VARCHAR" property="createdBy" /> | |
14 | + <result column="last_updated" jdbcType="TIMESTAMP" property="lastUpdated" /> | |
15 | + <result column="last_update_by" jdbcType="VARCHAR" property="lastUpdateBy" /> | |
16 | + </resultMap> | |
17 | + <sql id="Base_Column_List"> | |
18 | + <!--@mbg.generated--> | |
19 | + id, head_id, field_code, filed_name, filed_funcation, created, create_by, last_updated, | |
20 | + last_update_by | |
21 | + </sql> | |
22 | +</mapper> | |
0 | 23 | \ No newline at end of file |
... | ... |
src/main/resources/mybatis/system/SysTableInfoMapper.xml
0 → 100644
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.huaheng.pc.system.systable.mapper.SysTableInfoMapper"> | |
4 | + <resultMap id="BaseResultMap" type="com.huaheng.pc.system.systable.domain.SysTableInfo"> | |
5 | + <!--@mbg.generated--> | |
6 | + <!--@Table sys_table_info--> | |
7 | + <id column="id" jdbcType="BIGINT" property="id" /> | |
8 | + <result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" /> | |
9 | + <result column="table_code" jdbcType="VARCHAR" property="tableCode" /> | |
10 | + <result column="table_name" jdbcType="VARCHAR" property="tableName" /> | |
11 | + <result column="table_funcation" jdbcType="LONGVARCHAR" property="tableFuncation" /> | |
12 | + <result column="created" jdbcType="TIMESTAMP" property="created" /> | |
13 | + <result column="created_by" jdbcType="VARCHAR" property="createdBy" /> | |
14 | + <result column="last_updated" jdbcType="TIMESTAMP" property="lastUpdated" /> | |
15 | + <result column="last_update_by" jdbcType="VARCHAR" property="lastUpdateBy" /> | |
16 | + </resultMap> | |
17 | + <sql id="Base_Column_List"> | |
18 | + <!--@mbg.generated--> | |
19 | + id, warehouse_code, table_code, `table_name`, table_funcation, created, created_by, | |
20 | + last_updated, last_update_by | |
21 | + </sql> | |
22 | +</mapper> | |
0 | 23 | \ No newline at end of file |
... | ... |
src/main/resources/templates/table/table.html
0 → 100644
1 | +<!DOCTYPE html> | |
2 | +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> | |
3 | +<head th:include="include :: header"></head> | |
4 | +<body class="gray-bg"> | |
5 | +<div class="container-div"> | |
6 | + <div class="row"> | |
7 | + <div class="col-sm-12 select-info"> | |
8 | + <form id="dept-form"> | |
9 | + <div class="select-list"> | |
10 | + <ul> | |
11 | + <li> | |
12 | + 表名:<input type="text" name="tableCode"/> | |
13 | + </li> | |
14 | + <li> | |
15 | + 表中文名:<input type="text" name="tableName"/> | |
16 | + </li> | |
17 | + <li> | |
18 | + 启用状态:<select name="enable" th:with="type=${@dict.getType('sys_normal_disable')}"> | |
19 | + <option value="">所有</option> | |
20 | + <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option> | |
21 | + </select> | |
22 | + </li> | |
23 | + <li> | |
24 | + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i> 搜索</a> | |
25 | + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('dept-form')"><i class="fa fa-refresh"></i> 重置</a> | |
26 | + </li> | |
27 | + </ul> | |
28 | + </div> | |
29 | + </form> | |
30 | + </div> | |
31 | + <div class="btn-group hidden-xs" id="toolbar" role="group"> | |
32 | + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add(100)" shiro:hasPermission="system:table:add"> | |
33 | + <i class="fa fa-plus"></i> 新增 | |
34 | + </a> | |
35 | + </div> | |
36 | + | |
37 | + <div class="col-sm-12 select-info select-table table-striped"> | |
38 | + <table id="bootstrap-table" data-mobile-responsive="true"></table> | |
39 | + </div> | |
40 | + </div> | |
41 | +</div> | |
42 | +<div th:include="include :: footer"></div> | |
43 | +<script th:inline="javascript"> | |
44 | + const prefix = ctx + "system/tableInfo"; | |
45 | + const prefixDetails = ctx + "system/tableFieldInfo"; | |
46 | + const addFlag = [[${@permission.hasPermi('system:table:add')}]]; | |
47 | + const editFlag = [[${@permission.hasPermi('system:table:edit')}]]; | |
48 | + const removeFlag = [[${@permission.hasPermi('system:table:remove')}]]; | |
49 | + $(function () { | |
50 | + var options = { | |
51 | + url: prefix + "/list", | |
52 | + showSearch: false, | |
53 | + showRefresh: false, | |
54 | + showToggle: false, | |
55 | + showColumns: false, | |
56 | + detailView: true, | |
57 | + onExpandRow: function (index, row, $detail) { | |
58 | + initChildTable(index, row, $detail); | |
59 | + }, | |
60 | + columns: [{ | |
61 | + checkbox: true | |
62 | + }, | |
63 | + { | |
64 | + field: 'id', | |
65 | + title: 'id', | |
66 | + visible: false | |
67 | + }, | |
68 | + { | |
69 | + field: 'warehouseCode', | |
70 | + title: '仓库编码' | |
71 | + }, | |
72 | + { | |
73 | + field: 'tableCode', | |
74 | + title: '表名' | |
75 | + }, | |
76 | + { | |
77 | + field: 'tableName', | |
78 | + title: '表中文名' | |
79 | + }, | |
80 | + { | |
81 | + field: 'tableFuncation', | |
82 | + title: '表设计说明', | |
83 | + formatter: function (value, row, index) { | |
84 | + return $.table.tooltip(value, ); | |
85 | + } | |
86 | + }, | |
87 | + { | |
88 | + title: '操作', | |
89 | + align: 'center', | |
90 | + formatter: function (value, row, index) { | |
91 | + var actions = []; | |
92 | + actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>添加字段</a> '); | |
93 | + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); | |
94 | + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); | |
95 | + return actions.join(''); | |
96 | + } | |
97 | + }] | |
98 | + }; | |
99 | + $.table.init(options); | |
100 | + }); | |
101 | + | |
102 | + initChildTable = function (index, row, $detail) { | |
103 | + var cur_table = $detail.html('<table style="table-layout:fixed"></table>').find('table'); | |
104 | + $(cur_table).bootstrapTable({ | |
105 | + url: prefixDetails + "/list", | |
106 | + method: 'post', | |
107 | + sidePagination: "server", | |
108 | + contentType: "application/x-www-form-urlencoded", // 编码类型 | |
109 | + queryParams: { | |
110 | + headerId: row.id | |
111 | + }, | |
112 | + columns: [{ | |
113 | + field: 'id', | |
114 | + title: 'id', | |
115 | + visible: false | |
116 | + }, | |
117 | + { | |
118 | + field: 'fieldCode', | |
119 | + title: '字段名' | |
120 | + }, | |
121 | + { | |
122 | + field: 'fieldName', | |
123 | + title: '字段中文名' | |
124 | + }, | |
125 | + { | |
126 | + field: 'fieldFuncation', | |
127 | + title: '字段说明' | |
128 | + }] | |
129 | + }); | |
130 | + }; | |
131 | +</script> | |
132 | +</body> | |
133 | +</html> | |
0 | 134 | \ No newline at end of file |
... | ... |