Browse Source

sql修改

anderx 6 years ago
parent
commit
115468cb51
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/main/java/com/goafanti/common/mapper/IdleContractNoMapper.xml

+ 3 - 2
src/main/java/com/goafanti/common/mapper/IdleContractNoMapper.xml

@@ -301,7 +301,8 @@
     where id = #{id,jdbcType=INTEGER}
   </update>
   <select id="selectByAbbreviation" resultType="com.goafanti.common.model.IdleContractNo">
-  select id,abbreviation,used_order_no usedOrderNo,aid,create_time createTime,max(contract_no) contractNo from idle_contract_no
-	where abbreviation= #{abbreviation,jdbcType=VARCHAR}
+	select a.id,a.abbreviation,a.used_order_no usedOrderNo,a.aid,a.create_time createTime,a.contract_no contractNo from idle_contract_no a
+	where abbreviation= #{abbreviation,jdbcType=VARCHAR} 
+	and a.contract_no=(select max(contract_no)from idle_contract_no where abbreviation= #{abbreviation,jdbcType=VARCHAR})
   </select>
 </mapper>