Browse Source

修改报销账号限制,同人只能重复发起一次。

anderx 2 years ago
parent
commit
248bd1bfb9

+ 1 - 1
src/main/java/com/goafanti/common/dao/ExpenseAccountPrivateMapper.java

@@ -22,7 +22,7 @@ public interface ExpenseAccountPrivateMapper {
 
     void updateStatusByAid(InputExpenseAccountPrivate in);
 
-    ExpenseAccountPrivate selectByAccount(String accounts);
+    ExpenseAccountPrivate selectByAccount(InputExpenseAccountPrivate in);
 
     OutExpenseAccountPrivate selectById(Integer id);
 

+ 13 - 1
src/main/java/com/goafanti/common/mapper/ExpenseAccountPrivateMapper.xml

@@ -164,7 +164,19 @@
       select
       <include refid="Base_Column_List" />
       from expense_account_private
-      where accounts = #{accounts}
+      where 1=1
+      <if test="status !=null">
+        and status= #{status}
+      </if>
+      <if test="aid !=null">
+        and aid =#{aid}
+      </if>
+      <if test="accounts !=null">
+        and accounts =#{accounts}
+      </if>
+      <if test="name !=null">
+        and name =#{name}
+      </if>
     </select>
 
     <update id="updateStatusByAid">

+ 7 - 2
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountPrivateServiceImpl.java

@@ -106,10 +106,15 @@ public class ExpenseAccountPrivateServiceImpl extends BaseMybatisDao<ExpenseAcco
         return expenseAccountPrivateMapper.updateByPrimaryKeySelective(in);
     }
 
+
     @Override
     public boolean updateCheckAccounts(InputExpenseAccountPrivate in) {
-        ExpenseAccountPrivate accountPrivate = expenseAccountPrivateMapper.selectByAccount(in.getAccounts());
-        if (accountPrivate==null||accountPrivate.getAid().equals(in.getAid())){
+        InputExpenseAccountPrivate checkParam=new InputExpenseAccountPrivate();
+        checkParam.setAid(in.getAid());
+        checkParam.setAccounts(in.getAccounts());
+        checkParam.setName(in.getName());
+        ExpenseAccountPrivate accountPrivate = expenseAccountPrivateMapper.selectByAccount(checkParam);
+        if (accountPrivate==null||accountPrivate.getId().equals(in.getId())){
             return false;
         }else {
             return true;