Jelajahi Sumber

编号自增

lxp 1 tahun lalu
induk
melakukan
d9df659a93

+ 26 - 0
yinet-admin/src/main/java/com/yinet/web/controller/rlzy/RlzyApplyPrintController.java

@@ -65,6 +65,9 @@ public class RlzyApplyPrintController extends BaseController {
         rlzyApply.setStatus("0");
         rlzyApply.setOpeningDate(nowTime);
         rlzyApply.setEfficaciousDate(later5);
+        RlzyApply apply = addSelf();
+        rlzyApply.setLicenseNumber(apply.getLicenseNumber());
+        rlzyApply.setLicenseCode(apply.getLicenseCode());
         return toAjax(rlzyApplyService.insert(rlzyApply));
     }
     @GetMapping("/{idcard}")
@@ -120,4 +123,27 @@ public class RlzyApplyPrintController extends BaseController {
         }
         return  AjaxResult.success(rlzyApplyService.updateById(build));
     }
+
+    public RlzyApply addSelf(){
+        RlzyApply rlzyApply = rlzyApplyService.selectLastRlzyApply();
+        int licenseNumber = 1;
+        int licenseCode = 1;
+        if(rlzyApply != null){
+             licenseNumber = Integer.valueOf(rlzyApply.getLicenseNumber()).intValue();
+             licenseCode = Integer.valueOf(rlzyApply.getLicenseCode()).intValue();
+        }
+        if(licenseNumber / 1000 <1){
+            String format1 = String.format("%03d", licenseNumber + 1);
+            rlzyApply.setLicenseNumber(format1);
+        }else{
+            rlzyApply.setLicenseNumber(String.valueOf(licenseNumber));
+        }
+        if(licenseCode / 1000 <1){
+            String format2 = String.format("%03d", licenseCode + 1);
+            rlzyApply.setLicenseCode(format2);
+        }else{
+            rlzyApply.setLicenseCode(String.valueOf(licenseCode));
+        }
+        return rlzyApply;
+    }
 }

+ 1 - 1
yinet-admin/src/main/resources/templates/index.html

@@ -28,7 +28,7 @@
         <div class="sidebar-collapse">
             <ul class="nav" id="side-menu">
                 <li class="logo">
-				     <span class="logo-lg">Yinet</span>
+				     <span class="logo-lg">自助机后台</span>
             	</li>
             	<li>
             		<div class="user-panel">

+ 2 - 0
yinet-system/src/main/java/com/yinet/rlzy/mapper/RlzyApplyMapper.java

@@ -33,4 +33,6 @@ public interface RlzyApplyMapper extends Mapper<RlzyApply>
         public int deleteRlzyApplyByIds(String[] ids);
 
     List<RlzyApply> selectList(RlzyApply rlzy);
+
+    RlzyApply selectLastRlzyApply();
 }

+ 3 - 0
yinet-system/src/main/java/com/yinet/rlzy/service/IRlzyApplyService.java

@@ -30,4 +30,7 @@ public interface IRlzyApplyService extends BaseService<RlzyApply>
     public int deleteRlzyApplyByIds(String ids);
 
     List<RlzyApply> selectList(RlzyApply rlzy);
+
+    RlzyApply selectLastRlzyApply();
+
 }

+ 5 - 0
yinet-system/src/main/java/com/yinet/rlzy/service/impl/RlzyApplyServiceImpl.java

@@ -50,4 +50,9 @@ public class RlzyApplyServiceImpl extends BaseServiceImpl<RlzyApply> implements
     public List<RlzyApply> selectList(RlzyApply rlzy) {
         return rlzyApplyMapper.selectList(rlzy);
     }
+
+    @Override
+    public RlzyApply selectLastRlzyApply() {
+        return rlzyApplyMapper.selectLastRlzyApply();
+    }
 }

+ 4 - 0
yinet-system/src/main/resources/mapper/rlzy/RlzyApplyMapper.xml

@@ -143,6 +143,10 @@
             /*and  status = 1*/
         </where>
     </select>
+    <select id="selectLastRlzyApply" parameterType="RlzyApply" resultMap="RlzyApplyResult">
+        <include refid="selectRlzyApplyVo" />
+        order by id desc limit 1
+    </select>
     <delete id="deleteRlzyApplyByIds" parameterType="String">
         delete from rlzy_apply where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">