Showing
6 changed files
with
208 additions
and
0 deletions
@@ -15,4 +15,6 @@ public interface ResourcesGoodsPoolMapper { | @@ -15,4 +15,6 @@ public interface ResourcesGoodsPoolMapper { | ||
15 | void insertOrUpdate(@Param("list") List<ResGoodsPoolEditBo> param); | 15 | void insertOrUpdate(@Param("list") List<ResGoodsPoolEditBo> param); |
16 | 16 | ||
17 | void updateBatchByResGoodsPoolBo(@Param("list") List<ResGoodsPoolEditBo> param); | 17 | void updateBatchByResGoodsPoolBo(@Param("list") List<ResGoodsPoolEditBo> param); |
18 | + | ||
19 | + int updatePoolIdById(@Param("id")Integer id, @Param("poolId")Integer poolId, @Param("updateTime")Integer updateTime); | ||
18 | } | 20 | } |
1 | package com.yoho.ufo.model.resource; | 1 | package com.yoho.ufo.model.resource; |
2 | 2 | ||
3 | +import lombok.ToString; | ||
4 | + | ||
3 | /** | 5 | /** |
4 | * Created by shengguo.cai on 2018/11/19. | 6 | * Created by shengguo.cai on 2018/11/19. |
5 | */ | 7 | */ |
8 | +@ToString | ||
6 | public class ResourcesGoodsPool { | 9 | public class ResourcesGoodsPool { |
7 | private Integer id; | 10 | private Integer id; |
8 | private Integer createTime; | 11 | private Integer createTime; |
@@ -49,4 +49,8 @@ | @@ -49,4 +49,8 @@ | ||
49 | select <include refid="Base_Column_List" /> from resources_goods_pool | 49 | select <include refid="Base_Column_List" /> from resources_goods_pool |
50 | limit 10000 | 50 | limit 10000 |
51 | </select> | 51 | </select> |
52 | + | ||
53 | + <update id="updatePoolIdById"> | ||
54 | + update resources_goods_pool set pool_id = #{poolId}, update_time = #{updateTime} where id = #{id} | ||
55 | + </update> | ||
52 | </mapper> | 56 | </mapper> |
resource/src/main/java/com/yoho/ufo/resource/controller/ResourcesGoodsPoolController.java
0 → 100644
1 | +package com.yoho.ufo.resource.controller; | ||
2 | + | ||
3 | +import com.yoho.ufo.model.resource.ResourcesGoodsPool; | ||
4 | +import com.yoho.ufo.resource.service.IResourceService; | ||
5 | +import com.yoho.ufo.resource.service.impl.ResourcesGoodsPoolService; | ||
6 | +import com.yoho.ufo.service.model.ApiResponse; | ||
7 | +import com.yoho.ufo.service.model.PageRequestBO; | ||
8 | +import com.yoho.ufo.util.DateUtil; | ||
9 | +import com.yohobuy.ufo.resource.resp.ResourceGetBo; | ||
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
13 | +import org.springframework.web.bind.annotation.RequestBody; | ||
14 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
15 | +import org.springframework.web.bind.annotation.RestController; | ||
16 | + | ||
17 | +import java.util.List; | ||
18 | + | ||
19 | +/** | ||
20 | + * Created by shengguo.cai on 2018/11/16. | ||
21 | + */ | ||
22 | +@RestController | ||
23 | +@RequestMapping(value = "/ResourcesGoodsPool") | ||
24 | +public class ResourcesGoodsPoolController { | ||
25 | + | ||
26 | + private static final Logger LOGGER = LoggerFactory.getLogger(ResourcesGoodsPoolController.class); | ||
27 | + @Autowired | ||
28 | + private ResourcesGoodsPoolService resourcesGoodsPoolService; | ||
29 | + | ||
30 | + @RequestMapping(value = "/selectAll") | ||
31 | + public ApiResponse selectAll() { | ||
32 | + List<ResourcesGoodsPool> result = resourcesGoodsPoolService.selectAll(); | ||
33 | + return new ApiResponse.ApiResponseBuilder().code(200).data(result).build(); | ||
34 | + } | ||
35 | + | ||
36 | + @RequestMapping(value = "/updatePoolIdById") | ||
37 | + public ApiResponse updatePoolIdById(@RequestBody ResourcesGoodsPool resourcesGoodsPool) { | ||
38 | + LOGGER.info("ResourcesGoodsPoolController.updatePoolIdById in, "); | ||
39 | + int result = resourcesGoodsPoolService.updatePoolIdById(resourcesGoodsPool.getId(), resourcesGoodsPool.getPoolId()); | ||
40 | + return new ApiResponse.ApiResponseBuilder().code(200).data(result).build(); | ||
41 | + } | ||
42 | +} |
1 | +package com.yoho.ufo.resource.service.impl; | ||
2 | + | ||
3 | +import com.yoho.ufo.dal.ResourcesGoodsPoolMapper; | ||
4 | +import com.yoho.ufo.model.resource.ResourcesGoodsPool; | ||
5 | +import com.yoho.ufo.util.DateUtil; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by li.ma on 2019/8/8. | ||
13 | + */ | ||
14 | +@Service | ||
15 | +public class ResourcesGoodsPoolService { | ||
16 | + @Autowired | ||
17 | + private ResourcesGoodsPoolMapper resourcesGoodsPoolMapper; | ||
18 | + | ||
19 | + public List<ResourcesGoodsPool> selectAll() { | ||
20 | + return resourcesGoodsPoolMapper.selectAll(); | ||
21 | + } | ||
22 | + | ||
23 | + public int updatePoolIdById(Integer id, Integer poolId) { | ||
24 | + if (id == null || null == poolId) { | ||
25 | + return 0; | ||
26 | + } | ||
27 | + int result = resourcesGoodsPoolMapper.updatePoolIdById(id, poolId, DateUtil.getCurrentTimeSeconds()); | ||
28 | + | ||
29 | + // TODO 清理缓存 | ||
30 | + | ||
31 | + return result; | ||
32 | + } | ||
33 | +} |
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta charset="UTF-8"/> | ||
5 | + <title>Yoho!Buy运营平台</title> | ||
6 | + <script src="/ufoPlatform/js/include.js"></script> | ||
7 | + <script src="/ufoPlatform/js/ajaxfileupload.js"></script> | ||
8 | + <style> | ||
9 | + .btn-download span { | ||
10 | + line-height: 40px; | ||
11 | + color: #87CEFA; | ||
12 | + } | ||
13 | + </style> | ||
14 | +</head> | ||
15 | +<body class="easyui-layout" fit="true"> | ||
16 | +<div region="north" style="height: 160px"> | ||
17 | + <script> | ||
18 | + document.write(addHead('配置管理', '')); | ||
19 | + </script> | ||
20 | +</div> | ||
21 | +<div region="center"> | ||
22 | + <div style="margin-left: 30px;margin-top: 20px;height: 660px"> | ||
23 | + <table id="configTable"></table> | ||
24 | + </div> | ||
25 | +</div> | ||
26 | + | ||
27 | +<script type="text/javascript"> | ||
28 | + var param = {}; | ||
29 | + $(function () { | ||
30 | + | ||
31 | + $("#configTable").myDatagrid({ | ||
32 | + fit: true, | ||
33 | + fitColumns: true, | ||
34 | + nowrap: false, | ||
35 | + url: contextPath + "/ResourcesGoodsPool/selectAll", | ||
36 | + method: 'POST', | ||
37 | + loadFilter: function (data) { | ||
38 | + var temp = defaultLoadFilter(data); | ||
39 | + temp.rows = temp.list; | ||
40 | + return temp; | ||
41 | + }, | ||
42 | + columns: [[{ | ||
43 | + title: "配置说明", | ||
44 | + field: "poolName", | ||
45 | + width: 40, | ||
46 | + align: "center" | ||
47 | + }, { | ||
48 | + title: "配置值", | ||
49 | + field: "poolId", | ||
50 | + width: 80, | ||
51 | + align: "center", | ||
52 | + formatter: function (value, rowData) { | ||
53 | + var v = value==null?"":value; | ||
54 | + var str = "<input id='pool_id_"+rowData.id+"' type='text' value='"+v+"'>"; | ||
55 | + return str; | ||
56 | + } | ||
57 | + }, { | ||
58 | + title: "操作", | ||
59 | + field: "operations", | ||
60 | + width: 80, | ||
61 | + align: "center", | ||
62 | + formatter: function (value, rowData) { | ||
63 | + var str = "<a role='edit' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #5bc0de'>提交</a>"; | ||
64 | + return str; | ||
65 | + } | ||
66 | + }]], | ||
67 | + cache: false, | ||
68 | + pagination: true, | ||
69 | + pageSize: 10, | ||
70 | + pageList: [10], | ||
71 | + idField: "id", | ||
72 | + singleSelect: false, | ||
73 | + checkOnSelect: false, | ||
74 | + onLoadSuccess: function () { | ||
75 | + $.parser.parse($("#configTable").parent()); | ||
76 | + // 编辑 | ||
77 | + $(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({ | ||
78 | + iconCls: "icon-edit", | ||
79 | + onClick: function () { | ||
80 | + var id = $(this).attr("dataId"); | ||
81 | + editRow(id); | ||
82 | + } | ||
83 | + }); | ||
84 | + } | ||
85 | + }); | ||
86 | + | ||
87 | + | ||
88 | + function editRow(id) { | ||
89 | + debugger | ||
90 | + var pool_id = document.getElementById("pool_id_"+id).value; | ||
91 | + var ajaxData = {}; | ||
92 | + ajaxData.poolId = pool_id; | ||
93 | + ajaxData.id = id; | ||
94 | + | ||
95 | + $.ajax({ | ||
96 | + url: contextPath + '/ResourcesGoodsPool/updatePoolIdById', | ||
97 | + contentType: "application/json", | ||
98 | + dataType: "json", | ||
99 | + type: "POST", | ||
100 | + data: JSON.stringify(ajaxData), | ||
101 | + success: function(ret) { | ||
102 | + $.messager.progress("close"); | ||
103 | + if (ret && ret.code == 200 && ret.data == 1) { | ||
104 | + $.messager.show({ | ||
105 | + title:'操作提示', | ||
106 | + msg:'提交成功' | ||
107 | + }); | ||
108 | + $("#configTable").myDatagrid("load", param); | ||
109 | + } else { | ||
110 | + $.messager.alert('操作提示', '提交失败'); | ||
111 | + } | ||
112 | + }, | ||
113 | + error: function(err) { | ||
114 | + $.messager.progress("close"); | ||
115 | + $.messager.alert('操作提示', err.message || '提交失败'); | ||
116 | + } | ||
117 | + }); | ||
118 | + | ||
119 | + } | ||
120 | + }); | ||
121 | +</script> | ||
122 | + | ||
123 | +</body> | ||
124 | +</html> |
-
Please register or login to post a comment