Browse Source

判断当前是否存在草稿

anderx 2 years ago
parent
commit
67145e6889

+ 3 - 0
src/main/java/com/goafanti/common/dao/ExpenseAccountMapper.java

@@ -1,6 +1,7 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.common.model.ExpenseAccount;
+import com.goafanti.expenseAccount.bo.InputExpenseAccount;
 import com.goafanti.expenseAccount.bo.OutExpenseAccount;
 
 public interface ExpenseAccountMapper {
@@ -17,4 +18,6 @@ public interface ExpenseAccountMapper {
     int updateByPrimaryKey(ExpenseAccount record);
 
     OutExpenseAccount selectByid(Integer id);
+
+    OutExpenseAccount selectByaidAndPrid(InputExpenseAccount in);
 }

+ 13 - 2
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -263,11 +263,15 @@
     where id = #{id,jdbcType=INTEGER}
   </update>
 
-  <select id="selectByid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
-    SELECT a.id, a.prid, a.order_no orderNo, a.aid, a.aname, a.`type`, a.type_other typeOther , a.status, a.process_status processStatus,
+  <sql id="selectDtailsSql">
+    a.id, a.prid, a.order_no orderNo, a.aid, a.aname, a.`type`, a.type_other typeOther , a.status, a.process_status processStatus,
            a.total_amount totalAmount, a.attachment_url attachmentUrl,a.apply_dep applyDep, a.pay_dep payDep, a.eaaid,
            a.district_name districtName, a.user_names userNames,a.create_time, a.release_start,a.release_end, a.duration,
            b.name appDepName,c.name payDepName
+  </sql>
+  <select id="selectByid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
+    SELECT
+    <include refid="selectDtailsSql"/>
     FROM expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
     WHERE a.id= #{id}
   </select>
@@ -309,4 +313,11 @@
       and a.aid= #{aid}
     </if>
   </select>
+  <select id="selectByaidAndPrid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
+    SELECT
+    <include refid="selectDtailsSql"/>
+    FROM expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
+    WHERE a.status=0
+    and a.prid= #{prid} and a.aid = #{aid}
+  </select>
 </mapper>

+ 19 - 0
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountController.java

@@ -61,12 +61,31 @@ public class ExpenseAccountController extends CertifyApiController {
         return res;
     }
 
+    /**
+     * 报销列表
+     * @param in
+     * @return
+     */
     @RequestMapping(value = "/pageList",method = RequestMethod.GET)
     public Result pageList(InputPageListBo in ){
         Result res =new Result();
         res.setData(expenseAccountService.pageList(in));
         return res;
     }
+
+    /**
+     * 判断当前是否存在草稿
+     * @param in
+     * @return
+     */
+    @RequestMapping(value = "/selectByaidAndPrid",method = RequestMethod.GET)
+    public Result selectByaidAndPrid(InputExpenseAccount in ){
+        Result res =new Result();
+        res.setData(expenseAccountService.selectByaidAndPrid(in));
+        return res;
+    }
+
+
     /**
      * 新增报销详情
      * @param in

+ 2 - 0
src/main/java/com/goafanti/expenseAccount/service/ExpenseAccountService.java

@@ -23,4 +23,6 @@ public interface ExpenseAccountService {
     int updateExamine(InputExpenseAccount in);
 
     Object pageList(InputPageListBo in);
+
+    Object selectByaidAndPrid(InputExpenseAccount in);
 }

+ 7 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -135,6 +135,13 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         return findPage("selectExpenseAccountList", "selectExpenseAccountCount", param, in.getPageNo(), in.getPageSize());
     }
 
+    @Override
+    public Object selectByaidAndPrid(InputExpenseAccount in) {
+        in.setAid(TokenManager.getAdminId());
+        OutExpenseAccount useEa = expenseAccountMapper.selectByaidAndPrid(in);
+        return useEa;
+    }
+
     private void addParam(InputPageListBo in, Map<String, Object> param) {
         param.put("aid",TokenManager.getAdminId());
         if (in.getTimeSort()!=null){