ContractMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. <select id="selectFilterFailure" resultType="com.ydtech.modules.fnc.entity.ContractEntity">
  51. select
  52. ic.id as "id",
  53. "1" as "contractStatus"
  54. from
  55. ins_contract ic
  56. <where>
  57. ic.expiring_date is not null
  58. <if test="nowTime !=null and nowTime != ''">
  59. and ic.expiring_date &lt; #{nowTime}
  60. </if>
  61. </where>
  62. </select>
  63. <update id="updateMapper">
  64. UPDATE ins_contract
  65. set contract_code =#{contractCode},
  66. contract_name =#{contractName},
  67. internal_company_name =#{internalCompanyName},
  68. internal_company_id =#{internalCompanyId},
  69. external_companies_name =#{externalCompaniesName},
  70. external_companies_id =#{externalCompaniesId},
  71. supplier_name =#{supplierName},
  72. supplier_id =#{supplierId},
  73. contract_type =#{contractType},
  74. is_open_contract =#{isOpenContract},
  75. should_postponed =#{shouldPostponed},
  76. expiration_reminder =#{expirationReminder},
  77. effective_date =#{effectiveDate},
  78. expiring_date =#{expiringDate},
  79. should_postponed_date =#{shouldPostponedDate},
  80. should_postponed_effective_date =#{shouldPostponedEffectiveDate},
  81. file_path_id =#{filePathId},
  82. extern_type =#{externType},
  83. internal_type =#{internalType},
  84. parent_id =#{parentId},
  85. date_time =#{dateTime},
  86. date_type =#{dateType}
  87. WHERE id = #{id};
  88. </update>
  89. </mapper>