瀏覽代碼

sql修改

anderx 6 年之前
父節點
當前提交
115468cb51
共有 1 個文件被更改,包括 3 次插入2 次删除
  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>