|
@@ -6,6 +6,7 @@ import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.base.entity.MobileBannerInfo;
|
|
|
import com.jpsoft.employment.modules.base.service.MobileBannerInfoService;
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -24,11 +25,14 @@ public class MobileBannerInfoController {
|
|
|
|
|
|
@Autowired
|
|
|
private MobileBannerInfoService mobileBannerInfoService;
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value="创建空记录")
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dictionaryService;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "创建空记录")
|
|
|
@GetMapping("create")
|
|
|
- public MessageResult<MobileBannerInfo> create(){
|
|
|
+ public MessageResult<MobileBannerInfo> create() {
|
|
|
MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
MobileBannerInfo mobileBannerInfo = new MobileBannerInfo();
|
|
@@ -39,14 +43,14 @@ public class MobileBannerInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="添加信息")
|
|
|
+ @ApiOperation(value = "添加信息")
|
|
|
@PostMapping("add")
|
|
|
- public MessageResult<MobileBannerInfo> add(@RequestBody MobileBannerInfo mobileBannerInfo,@RequestAttribute String subject){
|
|
|
+ public MessageResult<MobileBannerInfo> add(@RequestBody MobileBannerInfo mobileBannerInfo, @RequestAttribute String subject) {
|
|
|
MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
mobileBannerInfo.setId(UUID.randomUUID().toString());
|
|
|
- mobileBannerInfo.setDelFlag(false);
|
|
|
+ mobileBannerInfo.setDelFlag(false);
|
|
|
mobileBannerInfo.setCreateBy(subject);
|
|
|
mobileBannerInfo.setCreateTime(new Date());
|
|
|
|
|
@@ -59,9 +63,8 @@ public class MobileBannerInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库添加失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -70,9 +73,9 @@ public class MobileBannerInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="获取信息")
|
|
|
+ @ApiOperation(value = "获取信息")
|
|
|
@GetMapping("edit/{id}")
|
|
|
- public MessageResult<MobileBannerInfo> edit(@PathVariable("id") String id){
|
|
|
+ public MessageResult<MobileBannerInfo> edit(@PathVariable("id") String id) {
|
|
|
MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -85,9 +88,8 @@ public class MobileBannerInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库不存在该记录!");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -96,15 +98,15 @@ public class MobileBannerInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新用户")
|
|
|
+ @ApiOperation(value = "更新用户")
|
|
|
@PostMapping("update")
|
|
|
- public MessageResult<MobileBannerInfo> update(@RequestBody MobileBannerInfo mobileBannerInfo,@RequestAttribute String subject){
|
|
|
+ public MessageResult<MobileBannerInfo> update(@RequestBody MobileBannerInfo mobileBannerInfo, @RequestAttribute String subject) {
|
|
|
MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
- mobileBannerInfo.setUpdateBy(subject);
|
|
|
+ mobileBannerInfo.setUpdateBy(subject);
|
|
|
mobileBannerInfo.setUpdateTime(new Date());
|
|
|
-
|
|
|
+
|
|
|
int affectCount = mobileBannerInfoService.update(mobileBannerInfo);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
@@ -114,9 +116,8 @@ public class MobileBannerInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库更新失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -125,19 +126,19 @@ public class MobileBannerInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="删除用户")
|
|
|
+ @ApiOperation(value = "删除用户")
|
|
|
@PostMapping("delete/{id}")
|
|
|
- public MessageResult<MobileBannerInfo> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
+ public MessageResult<MobileBannerInfo> delete(@PathVariable("id") String id, @RequestAttribute String subject) {
|
|
|
MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
-
|
|
|
- MobileBannerInfo mobileBannerInfo = mobileBannerInfoService.get(id);
|
|
|
+
|
|
|
+ MobileBannerInfo mobileBannerInfo = mobileBannerInfoService.get(id);
|
|
|
mobileBannerInfo.setDelFlag(true);
|
|
|
mobileBannerInfo.setUpdateBy(subject);
|
|
|
mobileBannerInfo.setUpdateTime(new Date());
|
|
|
-
|
|
|
- int affectCount = mobileBannerInfoService.update(mobileBannerInfo);
|
|
|
+
|
|
|
+ int affectCount = mobileBannerInfoService.update(mobileBannerInfo);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
msgResult.setResult(true);
|
|
@@ -145,9 +146,8 @@ public class MobileBannerInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库删除失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -157,9 +157,9 @@ public class MobileBannerInfoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @ApiOperation(value="批量删除")
|
|
|
+ @ApiOperation(value = "批量删除")
|
|
|
@PostMapping("batchDelete")
|
|
|
- public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
|
+ public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject) {
|
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -181,9 +181,8 @@ public class MobileBannerInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("删除失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -192,31 +191,39 @@ public class MobileBannerInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="列表")
|
|
|
- @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "列表")
|
|
|
+ @RequestMapping(value = "pageList", method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
String name,
|
|
|
- @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
- HttpServletRequest request){
|
|
|
- String subject = (String)request.getAttribute("subject");
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ String subject = (String) request.getAttribute("subject");
|
|
|
|
|
|
//当前用户ID
|
|
|
System.out.println(subject);
|
|
|
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("create_time","desc"));
|
|
|
+ sortList.add(new Sort("create_time", "desc"));
|
|
|
|
|
|
if (StringUtils.isNotEmpty(name)) {
|
|
|
- searchParams.put("name","%" + name + "%");
|
|
|
+ searchParams.put("name", "%" + name + "%");
|
|
|
}
|
|
|
|
|
|
|
|
|
- Page<MobileBannerInfo> page = mobileBannerInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ Page<MobileBannerInfo> page = mobileBannerInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
+
|
|
|
+ for (MobileBannerInfo mobileBannerInfo : page) {
|
|
|
+ if (StringUtils.isNotEmpty(mobileBannerInfo.getClassify())) {
|
|
|
+ String classifyN = dictionaryService.findNameByCatalogNameAndValue("首页图类型", mobileBannerInfo.getClassify());
|
|
|
+ mobileBannerInfo.setClassify(classifyN);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
msgResult.setResult(true);
|
|
@@ -226,10 +233,9 @@ public class MobileBannerInfoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- @ApiOperation(value="审核")
|
|
|
+ @ApiOperation(value = "审核")
|
|
|
@PostMapping("checkBannerInfo")
|
|
|
- public MessageResult<MobileBannerInfo> checkBannerInfo(@RequestBody MobileBannerInfo mobileBannerInfo,@RequestAttribute String subject){
|
|
|
+ public MessageResult<MobileBannerInfo> checkBannerInfo(@RequestBody MobileBannerInfo mobileBannerInfo, @RequestAttribute String subject) {
|
|
|
MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -248,9 +254,8 @@ public class MobileBannerInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库更新失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|