Browse Source

编号代码优化

guq 7 years ago
parent
commit
5a77d6fac5

+ 2 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/MaxnumbersMapper.java

@@ -33,4 +33,6 @@ public interface MaxnumbersMapper extends CommonBaseMapper<Maxnumbers>{
     int updateByPrimaryKey(Maxnumbers record);
 
     List<Maxnumbers> getListDataByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
+
+    Maxnumbers selectByCaller(@Param("caller")String caller, @Param("companyId") Long companyId);
 }

+ 2 - 5
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MaxnumberServiceImpl.java

@@ -246,11 +246,8 @@ public class MaxnumberServiceImpl extends CommonBaseServiceImpl<MaxnumbersMapper
     * @Date: 2018/10/19
     */
     private Maxnumbers getMaxnumbers(String caller) {
-        MaxnumbersExample example = new MaxnumbersExample();
-        MaxnumbersExample.Criteria cta = example.createCriteria();
-        cta.andCompanyIdEqualTo(BaseContextHolder.getCompanyId());
-        cta.andMn_callerEqualTo(caller);
-        return maxnumbersMapper.selectByExample(example);
+       Long companyId = BaseContextHolder.getCompanyId();
+        return maxnumbersMapper.selectByCaller(caller, companyId);
     }
     /**
     * @Description

+ 13 - 0
applications/commons/commons-server/src/main/resources/mapper/MaxnumbersMapper.xml

@@ -12,6 +12,7 @@
     <result column="creatorId" property="creatorId" jdbcType="INTEGER" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
     <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="mn_rule" property="mn_rule" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Example_Where_Clause" >
     <where >
@@ -292,4 +293,16 @@
         </where>
         ORDER BY MN_ID DESC
     </select>
+  <select id="selectByCaller" resultMap="BaseResultMap">
+    SELECT * FROM MAXNUMBERS
+    <where>
+      <if test="caller">
+        and mn_caller=#{caller}
+      </if>
+      <if test="companyId">
+        and COMPANYID=#{companyId}
+      </if>
+    </where>
+    ORDER BY MN_ID DESC
+  </select>
 </mapper>