Browse Source

add 支付配置

周箭河 5 years ago
parent
commit
c66555092e

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysPaymentConfigDao.java

@@ -2,6 +2,8 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
 
 public interface SysPaymentConfigDao extends BaseDAO<Integer, SysPaymentConfig> {
+    SysPaymentConfig findPaymentConfigByOrganId(@Param("organId") Integer organId);
 }

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysPaymentConfigService.java

@@ -5,5 +5,6 @@ import com.ym.mec.common.service.BaseService;
 
 public interface SysPaymentConfigService extends BaseService<Integer, SysPaymentConfig> {
 
+    SysPaymentConfig findPaymentConfigByOrganId(Integer organId);
 
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysPaymentConfigServiceImpl.java

@@ -17,4 +17,9 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     public BaseDAO<Integer, SysPaymentConfig> getDAO() {
         return sysPaymentConfigDao;
     }
+
+    @Override
+    public SysPaymentConfig findPaymentConfigByOrganId(Integer organId) {
+        return sysPaymentConfigDao.findPaymentConfigByOrganId(organId);
+    }
 }

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml

@@ -157,4 +157,9 @@
         SELECT COUNT(*) FROM sys_payment_config
         <include refid="global.limit"/>
     </select>
+
+    <!-- 按分部编号查配置 -->
+    <select id="findPaymentConfigByOrganId" resultMap="SysPaymentConfig">
+        SELECT * FROM sys_payment_config WHERE organ_id_ = #{organId}
+    </select>
 </mapper>

+ 17 - 9
mec-web/src/main/java/com/ym/mec/web/controller/SysPaymentConfigController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,18 +23,25 @@ public class SysPaymentConfigController extends BaseController {
     @ApiOperation(value = "新增支付配置")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/add')")
-    public Object add(SysPaymentConfig sysPaymentConfig){
+    public HttpResponseResult add(SysPaymentConfig sysPaymentConfig) {
+        if (sysPaymentConfig.getOrganId() == null) {
+            return failed("请选择分部");
+        }
+        SysPaymentConfig paymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(sysPaymentConfig.getOrganId());
+        if (paymentConfig != null) {
+            return failed("改声部配置已经存在");
+        }
         return succeed(sysPaymentConfigService.insert(sysPaymentConfig));
     }
 
     @ApiOperation(value = "删除支付配置")
     @PostMapping("/del/{id}")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/del')")
-    public Object del(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id){
-    	SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.get(id);
-    	if(sysPaymentConfig == null){
-    		return failed("参数错误");
-    	}
+    public Object del(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id) {
+        SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.get(id);
+        if (sysPaymentConfig == null) {
+            return failed("参数错误");
+        }
         sysPaymentConfigService.delete(id);
         return succeed();
     }
@@ -41,7 +49,7 @@ public class SysPaymentConfigController extends BaseController {
     @ApiOperation(value = "修改支付配置")
     @PostMapping("/update")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/update')")
-    public Object update(SysPaymentConfig sysPaymentConfig){
+    public Object update(SysPaymentConfig sysPaymentConfig) {
         sysPaymentConfig.setUpdateTime(new Date());
         sysPaymentConfigService.update(sysPaymentConfig);
         return succeed();
@@ -50,14 +58,14 @@ public class SysPaymentConfigController extends BaseController {
     @ApiOperation(value = "根据支付配置编号查询支付配置")
     @GetMapping("/get/{id}")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/get')")
-    public Object get(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id){
+    public Object get(@ApiParam(value = "支付配置编号", required = true) @PathVariable("id") Integer id) {
         return succeed(sysPaymentConfigService.get(id));
     }
 
     @ApiOperation(value = "分页查询支付配置列表")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/queryPage')")
-    public Object queryPage(QueryInfo queryInfo){
+    public Object queryPage(QueryInfo queryInfo) {
         return succeed(sysPaymentConfigService.queryPage(queryInfo));
     }
 }