ContractMapper.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ydtech.modules.fnc.dao.contract.ContractMapper">
  4. <select id="queryPage" resultType="com.ydtech.modules.fnc.entity.ContractEntity">
  5. select * from
  6. ins_contract ic
  7. <where>
  8. <if test="vo.contractCode !=null and vo.contractCode !=''">
  9. and (ic.contract_code like concat('%',#{vo.contractCode},'%') or ic.contract_name like concat('%',#{vo.contractCode},'%'))
  10. </if>
  11. <if test="vo.contractIdList != null and vo.contractIdList !='' and vo.contractIdList.size()>0 ">
  12. and ic.id IN
  13. <foreach collection="vo.contractIdList" item="id" index="index" open="(" close=")" separator=",">
  14. #{id}
  15. </foreach>
  16. </if>
  17. <if test="vo.contractName !=null and vo.contractName !=''">
  18. and ic.contract_name =#{vo.contractName}
  19. </if>
  20. <if test="vo.internalCompanyId !=null and vo.internalCompanyId !=''">
  21. and ic.internal_company_id =#{vo.internalCompanyId}
  22. </if>
  23. <if test="vo.externalCompaniesId !=null and vo.externalCompaniesId !=''">
  24. and ic.external_companies_id =#{vo.externalCompaniesId}
  25. </if>
  26. <if test="vo.supplierId !=null and vo.supplierId !=''">
  27. and ic.supplier_id =#{vo.supplierId}
  28. </if>
  29. <if test="vo.contractType !=null and vo.contractType !=''">
  30. and ic.contract_type =#{vo.contractType}
  31. </if>
  32. <if test="vo.contractStatus !=null and vo.contractStatus !='' and vo.contractStatus !='all'">
  33. and ic.contract_status =#{vo.contractStatus}
  34. </if>
  35. </where>
  36. </select>
  37. <select id="getMaxCode" resultType="java.util.HashMap">
  38. SELECT MAX(CAST(RIGHT(REGEXP_REPLACE(contract_code, '[^0-9]', ''), 3) AS UNSIGNED)) AS "contractCode"
  39. FROM ins_contract
  40. </select>
  41. <select id="copyContractCode" resultType="java.util.HashMap">
  42. SELECT MAX(CAST(RIGHT(REGEXP_REPLACE(contract_code, '[^0-9]', ''), 1) AS UNSIGNED)) AS "contractCode"
  43. FROM ins_contract
  44. <where>
  45. <if test="id !=null and id !=''">
  46. and parent_id =#{id}
  47. </if>
  48. </where>
  49. </select>
  50. </mapper>