ProjectMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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="cn.cslg.pas.mapper.ProjectMapper">
  4. <select id="getPageList" parameterType="cn.cslg.pas.common.model.vo.ProjectVO"
  5. resultType="cn.cslg.pas.domain.Project">
  6. select a.id, a.`name`, a.creat_id as create_by, a.technical_theme,
  7. a.innerfile as inner_file, a.`update`, a.`status`, a.contract_no,
  8. a.`case` as case_date, a.update_time, a.sort, a.clientid as client_id,
  9. a.scenarioid as scenario, a.typeid as type, a.remark,
  10. a.create_time,a.department_id,a.personnel_id,a.product_id,a.structure_id,a.is_category,
  11. u.`name` as create_name,
  12. (select count(*) from os_thematic_file where zid = a.id and type = 1) as report_num
  13. from os_thematic a
  14. left join os_distribution u on u.id = a.creat_id
  15. <where>
  16. <if test="params.name != '' and params.name != null">
  17. and a.name like concat('%', #{params.name}, '%')
  18. </if>
  19. <if test="params.technicalTheme != '' and params.technicalTheme != null">
  20. and a.technical_theme like concat('%', #{params.technicalTheme}, '%')
  21. </if>
  22. <if test="params.innerFile != '' and params.innerFile != null">
  23. and a.innerfile like concat('%', #{params.innerFile}, '%')
  24. </if>
  25. <if test="params.departmentId != '' and params.departmentId != null">
  26. and a.department_id = #{params.departmentId}
  27. </if>
  28. <if test="params.personnelIds != null and params.personnelIds.size() != 0">
  29. and a.creat_id in
  30. <foreach item="item" collection="params.personnelIds" index="index" open="(" separator="," close=")">
  31. #{item}
  32. </foreach>
  33. </if>
  34. <if test="params.type != null and params.type.size() != 0">
  35. <foreach item="item" index="index" collection="params.type" open=" and (" separator="or" close=")">
  36. FIND_IN_SET(#{item}, a.typeid)
  37. </foreach>
  38. </if>
  39. <if test="params.scenario != null and params.scenario.size() != 0">
  40. <foreach item="item" index="index" collection="params.scenario" open=" and (" separator="or" close=")">
  41. FIND_IN_SET(#{item}, a.scenarioid)
  42. </foreach>
  43. </if>
  44. <if test="params.PersonnelId!=null">
  45. and (a.id in (select tid from os_distribution_doing where uid=#{params.PersonnelId} )
  46. or a.creat_id = #{params.PersonnelId}
  47. <if test="params.tenantId!=null">
  48. or a.tenantId = #{params.tenantId}
  49. </if>
  50. )
  51. </if>
  52. <if test="params.eventId != null and params.eventId != ''">
  53. and a.id in (select project_id from asso_event_project where event_id = #{params.eventId})
  54. </if>
  55. </where>
  56. order by a.`${params.sort.prop}` ${params.sort.order}
  57. </select>
  58. <select id="getProjects" parameterType="cn.cslg.pas.common.model.vo.ProjectVO"
  59. resultType="cn.cslg.pas.domain.Project">
  60. select a.id
  61. from os_thematic a
  62. left join os_distribution u on u.id = a.creat_id
  63. <where>
  64. <if test="PersonnelId!=null">
  65. and (a.id in (select tid from os_distribution_doing where uid=#{PersonnelId} )
  66. or a.creat_id = #{PersonnelId}
  67. <if test="tenantId!=null">
  68. or a.tenantId = #{tenantId}
  69. </if>
  70. )
  71. </if>
  72. </where>
  73. </select>
  74. <select id="getListForCount"
  75. resultType="cn.cslg.pas.domain.Project"
  76. parameterType="cn.cslg.pas.common.model.vo.ProjectVO">
  77. select a.id, a.`name`, a.creat_id as create_by, a.technical_theme,
  78. a.innerfile as inner_file, a.`update`, a.`status`, a.contract_no,
  79. a.`case` as case_date, a.update_time, a.sort, a.clientid as client_id,
  80. a.scenarioid as scenario, a.typeid as type, a.remark, a.create_time,a.department_id,a.personnel_id
  81. from os_thematic a
  82. <where>
  83. <if test="params.PersonnelId!=null">
  84. and a.id in (select tid from os_distribution_doing where uid=#{params.PersonnelId} )
  85. <if test="params.tenantId!=null">
  86. or a.tenantId = #{params.tenantId}
  87. </if>
  88. </if>
  89. </where>
  90. </select>
  91. <!--根据产品id统计数量-->
  92. <!--int countByProductId(Integer productId);-->
  93. <select id="countByProductId" resultType="int">
  94. select count(*)
  95. from os_thematic
  96. where product_id = #{productId}
  97. </select>
  98. <!--根据id查询数据-->
  99. <!--ProjectVO getStandardById(Integer id);-->
  100. <select id="getStandardById" resultMap="getStandardByIdMap">
  101. select id,
  102. product_id,
  103. structure_id,
  104. is_category
  105. from os_thematic
  106. where id = #{id}
  107. </select>
  108. <resultMap id="getStandardByIdMap" type="cn.cslg.pas.common.model.vo.ProjectStandardVO">
  109. <id column="id" property="id"/>
  110. <result column="product_id" property="productId"/>
  111. <result column="structure_id" property="structureId"/>
  112. <result column="is_category" property="isCategory"/>
  113. </resultMap>
  114. </mapper>