Explorar el Código

移动端广告

xiao547607 hace 4 años
padre
commit
806d77535d

+ 2 - 2
common/src/main/java/com/jpsoft/bus/modules/bus/entity/CompanyInfo.java

@@ -9,10 +9,10 @@ import org.springframework.format.annotation.DateTimeFormat;
 import java.util.Date;
 
 /**
-  描述:base_company_info的实体类
+  描述:bus_company_info的实体类
  */
 @Data
-@ApiModel(value = "base_company_info的实体类")
+@ApiModel(value = "bus_company_info的实体类")
 public class CompanyInfo {
     @ApiModelProperty(value = "公司编号")
 	private String id;

+ 1 - 1
common/src/main/resources/mapper/sys/User.xml

@@ -103,7 +103,7 @@
 			select a.*,
 			b.name_ as company_name
 			from sys_user a
-			LEFT JOIN base_company_info b ON a.company_id = b.id_
+			LEFT JOIN bus_company_info b ON a.company_id = b.id_
 			where a.del_flag = 0
 		]]>
         <if test="searchParams.userName != null">

+ 245 - 0
web/src/main/java/com/jpsoft/bus/modules/base/controller/MobileBannerInfoController.java

@@ -0,0 +1,245 @@
+package com.jpsoft.bus.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.base.entity.MobileBannerInfo;
+import com.jpsoft.bus.modules.base.service.MobileBannerInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.jpsoft.bus.modules.common.utils.PojoUtils;
+import com.jpsoft.bus.modules.sys.entity.DataDictionary;
+import com.jpsoft.bus.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/mobileBannerInfo")
+@Api(description = "移动端广告栏管理")
+public class MobileBannerInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private MobileBannerInfoService mobileBannerInfoService;
+
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<MobileBannerInfo> create(){
+        MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
+
+        MobileBannerInfo mobileBannerInfo = new MobileBannerInfo();
+
+        msgResult.setData(mobileBannerInfo);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+    
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    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.setCreateBy(subject);
+            mobileBannerInfo.setCreateTime(new Date());
+            
+            int affectCount = mobileBannerInfoService.insert(mobileBannerInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(mobileBannerInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<MobileBannerInfo> edit(@PathVariable("id") String id){
+        MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
+
+        try {
+            MobileBannerInfo mobileBannerInfo = mobileBannerInfoService.get(id);
+
+            if (mobileBannerInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(mobileBannerInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<MobileBannerInfo> update(@RequestBody MobileBannerInfo mobileBannerInfo, @RequestAttribute String subject){
+        MessageResult<MobileBannerInfo> msgResult = new MessageResult<>();
+
+        try {
+            mobileBannerInfo.setUpdateBy(subject);
+            mobileBannerInfo.setUpdateTime(new Date());
+            
+            int affectCount = mobileBannerInfoService.update(mobileBannerInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(mobileBannerInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+	@ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id, @RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            MobileBannerInfo mobileBannerInfo = mobileBannerInfoService.get(id);
+            mobileBannerInfo.setDelFlag(true);
+            mobileBannerInfo.setUpdateBy(subject);
+            mobileBannerInfo.setUpdateTime(new Date());
+
+            int affectCount = mobileBannerInfoService.update(mobileBannerInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                MobileBannerInfo mobileBannerInfo = mobileBannerInfoService.get(id);
+                mobileBannerInfo.setDelFlag(true);
+                mobileBannerInfo.setUpdateBy(subject);
+                mobileBannerInfo.setUpdateTime(new Date());
+
+                affectCount += mobileBannerInfoService.update(mobileBannerInfo);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="分页列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String name,String classify,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("classify_","asc"));
+        sortList.add(new Sort("sort_no","asc"));
+
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name","%" + name + "%");
+        }
+
+        if (StringUtils.isNotEmpty(classify)) {
+            searchParams.put("classify",classify);
+        }
+
+        List<DataDictionary> classifyList = dataDictionaryService.findByCatalogName("移动端广告栏分类");
+
+        Map<String,String> classifyMap = new HashMap<>();
+
+        for (DataDictionary dd : classifyList) {
+            classifyMap.put(dd.getValue(),dd.getName());
+        }
+
+        Page<MobileBannerInfo> page = mobileBannerInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        for (MobileBannerInfo mobileBannerInfo : page) {
+            mobileBannerInfo.setClassifyN(classifyMap.get(mobileBannerInfo.getClassify()));
+        }
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+}