|
@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
|
14
|
14
|
import org.springframework.beans.factory.annotation.Autowired;
|
15
|
15
|
import org.springframework.web.bind.annotation.*;
|
16
|
16
|
|
|
17
|
+import javax.servlet.http.HttpServletRequest;
|
17
|
18
|
import java.time.LocalDateTime;
|
18
|
19
|
|
19
|
20
|
/**
|
|
@@ -42,7 +43,7 @@ public class TaCustomImgController extends BaseController {
|
42
|
43
|
*/
|
43
|
44
|
@RequestMapping(value="/admin/taCustomImg",method= RequestMethod.GET)
|
44
|
45
|
public ResponseBean taCustomImgList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
45
|
|
- @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
|
46
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize, HttpServletRequest request){
|
46
|
47
|
ResponseBean responseBean = new ResponseBean();
|
47
|
48
|
try {
|
48
|
49
|
//使用分页插件
|
|
@@ -66,18 +67,19 @@ public class TaCustomImgController extends BaseController {
|
66
|
67
|
* @return
|
67
|
68
|
*/
|
68
|
69
|
@RequestMapping(value="/admin/taCustomImg",method= RequestMethod.POST)
|
69
|
|
- public ResponseBean taCustomImgAdd(@RequestBody TaCustomImg taCustomImg){
|
|
70
|
+ public ResponseBean taCustomImgAdd(@RequestBody TaCustomImg taCustomImg, HttpServletRequest request){
|
70
|
71
|
ResponseBean responseBean = new ResponseBean();
|
71
|
72
|
taCustomImg.setImgDesc(CommConstant.BANNER_INDEX.equals(taCustomImg.getImgType()) ? "小程序首页分享配图" : "小程序首页推荐客户入口配图");
|
72
|
73
|
try {
|
73
|
74
|
taCustomImg.setCreateTime(LocalDateTime.now());
|
74
|
75
|
taCustomImg.setUpdateTime(LocalDateTime.now());
|
75
|
|
- boolean countFlag = iTaCustomImgService.countCustomImg(taCustomImg);
|
|
76
|
+ boolean countFlag = iTaCustomImgService.countCustomImg(taCustomImg, getOrgId(request));
|
76
|
77
|
if (!countFlag){
|
77
|
78
|
responseBean.addError("您已新增首页分享或推荐客户图,请勿重复添加");
|
78
|
79
|
return responseBean;
|
79
|
80
|
}
|
80
|
81
|
|
|
82
|
+ taCustomImg.setOrgId(getOrgId(request));
|
81
|
83
|
if (iTaCustomImgService.save(taCustomImg)){
|
82
|
84
|
responseBean.addSuccess(taCustomImg);
|
83
|
85
|
}else {
|
|
@@ -115,16 +117,20 @@ public class TaCustomImgController extends BaseController {
|
115
|
117
|
|
116
|
118
|
/**
|
117
|
119
|
* 修改对象
|
118
|
|
- * @param id 实体ID
|
119
|
120
|
* @param taCustomImg 实体对象
|
120
|
121
|
* @return
|
121
|
122
|
*/
|
122
|
|
- @RequestMapping(value="/admin/taCustomImg/{id}",method= RequestMethod.PUT)
|
123
|
|
- public ResponseBean taCustomImgUpdate(@PathVariable Integer id,
|
124
|
|
- @RequestBody TaCustomImg taCustomImg){
|
|
123
|
+ @RequestMapping(value="/admin/taCustomImg",method= RequestMethod.PUT)
|
|
124
|
+ public ResponseBean taCustomImgUpdate(@RequestBody TaCustomImg taCustomImg, HttpServletRequest request){
|
125
|
125
|
ResponseBean responseBean = new ResponseBean();
|
126
|
126
|
try {
|
127
|
127
|
taCustomImg.setUpdateTime(LocalDateTime.now());
|
|
128
|
+ boolean countFlag = iTaCustomImgService.countCustomImg(taCustomImg, getOrgId(request));
|
|
129
|
+ if (!countFlag){
|
|
130
|
+ responseBean.addError("您已新增首页分享或推荐客户图,请勿重复添加");
|
|
131
|
+ return responseBean;
|
|
132
|
+ }
|
|
133
|
+
|
128
|
134
|
if (iTaCustomImgService.updateById(taCustomImg)){
|
129
|
135
|
responseBean.addSuccess(taCustomImg);
|
130
|
136
|
}else {
|
|
@@ -160,11 +166,12 @@ public class TaCustomImgController extends BaseController {
|
160
|
166
|
* @param imgType
|
161
|
167
|
*/
|
162
|
168
|
@RequestMapping(value="/wx/taCustomImg",method= RequestMethod.GET)
|
163
|
|
- public ResponseBean taCustomImgGet(@RequestParam(value ="imgType") String imgType){
|
|
169
|
+ public ResponseBean taCustomImgGet(@RequestParam(value ="imgType") String imgType,HttpServletRequest request){
|
164
|
170
|
ResponseBean responseBean = new ResponseBean();
|
165
|
171
|
try {
|
166
|
172
|
QueryWrapper<TaCustomImg> queryWrapper = new QueryWrapper<>();
|
167
|
173
|
queryWrapper.eq("img_type", imgType);
|
|
174
|
+ queryWrapper.eq("org_id", getOrgId(request));
|
168
|
175
|
TaCustomImg taCustomImg = iTaCustomImgService.getOne(queryWrapper);
|
169
|
176
|
responseBean.addSuccess(taCustomImg);
|
170
|
177
|
}catch (Exception e){
|