ContractSupplierMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.ContractSupplierMapper">
  4. <delete id="deleteBySupplierIds">
  5. delete from ins_contract_supplier
  6. <where>
  7. <if test="supplierIdList != null and supplierIdList != '' and supplierIdList.size() > 0">
  8. and supplier_id in
  9. <foreach collection="supplierIdList" item="item" open="(" separator="," close=")">
  10. #{item}
  11. </foreach>
  12. </if>
  13. <if test="id !=null and id !=''">
  14. and contract_id =#{id}
  15. </if>
  16. </where>
  17. </delete>
  18. <select id="selectByContractId" resultType="com.ydtech.modules.fnc.entity.ContractSupplierEntity">
  19. select
  20. ics.id as "id",
  21. ics.supplier_id as "supplierId",
  22. ics.contract_id as "contractId",
  23. ics.create_time as "createTime",
  24. ics.dept_id as "deptId",
  25. ics.user_id as "userId",
  26. eic.namesimple as "namesimple"
  27. from ins_contract_supplier ics
  28. left join esm_ins_company eic on eic.id =ics.supplier_id
  29. <where>
  30. <if test="id != null and id !=''">
  31. and ics.contract_id =#{id}
  32. </if>
  33. </where>
  34. </select>
  35. <select id="selecSupplierList" resultType="com.ydtech.modules.fnc.entity.ContractSupplierEntity">
  36. select
  37. ics.id as "id",
  38. ics.supplier_id as "supplierId",
  39. ics.contract_id as "contractId",
  40. ics.create_time as "createTime",
  41. ics.dept_id as "deptId",
  42. ics.user_id as "userId",
  43. eic.namesimple as "namesimple"
  44. from ins_contract_supplier ics
  45. left join esm_ins_company eic on eic.id =ics.supplier_id
  46. <where>
  47. <if test="id != null and id !=''">
  48. and ics.contract_id =#{id}
  49. </if>
  50. <if test="supplierIdList != null and supplierIdList !='' and supplierIdList.size()>0 ">
  51. and ics.supplierId IN
  52. <foreach collection="supplierIdList" item="id" index="index" open="(" close=")" separator=",">
  53. #{id}
  54. </foreach>
  55. </if>
  56. </where>
  57. </select>
  58. <select id="queryPage" resultType="com.ydtech.modules.fnc.dto.contract.ContractDto">
  59. select
  60. ics.supplier_id as "supplierId",
  61. eic.namesimple as "namesimple",
  62. ic.contract_code as "contractCode",
  63. ic.contract_name as "contractName",
  64. ic.contract_type as "contractType",
  65. ic.internal_company_id as "internalCompanyId",
  66. ic.internal_company_name as "internalCompanyName",
  67. ic.external_companies_name as "externalCompaniesName",
  68. ic.external_companies_id as "externalCompaniesId",
  69. ic.extern_type as "externType",
  70. ic.internal_type as "internalType",
  71. ic.is_open_contract as "isOpenContract",
  72. ic.effective_date as "effectiveDate",
  73. ic.expiring_date as "expiringDate",
  74. ic.should_postponed_effective_date as "shouldPostponedEffectiveDate",
  75. ic.id as "id"
  76. from ins_contract_supplier ics
  77. left join esm_ins_company eic on eic.id =ics.supplier_id
  78. left join ins_contract ic on ic.id =ics.contract_id
  79. <where>
  80. <if test="vo.contractCode !=null and vo.contractCode !=''">
  81. and ic.contract_code like concat('%',#{vo.contractCode},'%')
  82. </if>
  83. <if test="vo.contractIdList != null and vo.contractIdList !='' and vo.contractIdList.size()>0 ">
  84. and ic.id IN
  85. <foreach collection="vo.contractIdList" item="id" index="index" open="(" close=")" separator=",">
  86. #{id}
  87. </foreach>
  88. </if>
  89. <if test="vo.contractName !=null and vo.contractName !=''">
  90. and ic.contract_name =#{vo.contractName}
  91. </if>
  92. <if test="vo.internalCompanyId !=null and vo.internalCompanyId !=''">
  93. and ic.internal_company_id =#{vo.internalCompanyId}
  94. </if>
  95. <if test="vo.externalCompaniesId !=null and vo.externalCompaniesId !=''">
  96. and ic.external_companies_id =#{vo.externalCompaniesId}
  97. </if>
  98. <if test="vo.supplierId !=null and vo.supplierId !=''">
  99. and ic.supplier_id =#{vo.supplierId}
  100. </if>
  101. <if test="vo.contractType !=null and vo.contractType !=''">
  102. and ic.contract_type =#{vo.contractType}
  103. </if>
  104. <if test="vo.contractStatus !=null and vo.contractStatus !='' and vo.contractStatus !='all'">
  105. and ic.contract_status =#{vo.contractStatus}
  106. </if>
  107. </where>
  108. </select>
  109. </mapper>