ProjectMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.com.ty.lift.business.project.dao.mapper.ProjectMapper" >
  4. <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.project.dao.entity.Project" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
  7. <result column="pp_company_id" property="ppCompanyId" jdbcType="BIGINT" />
  8. <result column="pp_contact_id" property="ppContactId" jdbcType="BIGINT" />
  9. <result column="project_code" property="projectCode" jdbcType="CHAR" />
  10. <result column="project_name" property="projectName" jdbcType="VARCHAR" />
  11. <result column="province_code" property="provinceCode" jdbcType="CHAR" />
  12. <result column="province" property="province" jdbcType="VARCHAR" />
  13. <result column="city_code" property="cityCode" jdbcType="CHAR" />
  14. <result column="city" property="city" jdbcType="VARCHAR" />
  15. <result column="district_code" property="districtCode" jdbcType="CHAR" />
  16. <result column="district" property="district" jdbcType="VARCHAR" />
  17. <result column="address" property="address" jdbcType="VARCHAR" />
  18. <result column="num" property="num" jdbcType="INTEGER" />
  19. <result column="actual_num" property="actualNum" jdbcType="INTEGER" />
  20. <result column="project_usage" property="projectUsage" jdbcType="TINYINT" />
  21. <result column="start_date" property="startDate" jdbcType="DATE" />
  22. <result column="end_date" property="endDate" jdbcType="DATE" />
  23. <result column="project_status" property="projectStatus" jdbcType="TINYINT" />
  24. <result column="remarks" property="remarks" jdbcType="VARCHAR" />
  25. <result column="is_locked" property="isLocked" jdbcType="TINYINT" />
  26. <result column="creator_id" property="creatorId" jdbcType="BIGINT" />
  27. <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  28. <result column="evaluate" property="evaluate" jdbcType="INTEGER" />
  29. <result column="end_remarks" property="endRemarks" jdbcType="VARCHAR" />
  30. <result column="if_monitor" property="ifMonitor" jdbcType="INTEGER" />
  31. <result column="all_project" property="allProject" jdbcType="INTEGER" />
  32. <result column="region_id" property="regionId" jdbcType="BIGINT" />
  33. </resultMap>
  34. <sql id="Base_Column_List" >
  35. id, mt_company_id, pp_company_id, pp_contact_id, project_code, project_name, province_code,
  36. province, city_code, city, district_code, district, address, num, actual_num, project_usage,
  37. start_date, end_date, project_status, remarks, is_locked, creator_id, create_date,
  38. evaluate, end_remarks, if_monitor, all_project, region_id
  39. </sql>
  40. <!-- 根据省,市,区,区域,区域主管,项目名称、项目编号、甲方名称、项目地址查询项目管理列表-->
  41. <select id="findByCondition" resultType="cn.com.ty.lift.business.project.dao.entity.model.ProjectResponse" parameterType="cn.com.ty.lift.business.project.dao.entity.model.ProjectRequest" >
  42. SELECT
  43. p.id as id,
  44. p.project_code as projectCode,
  45. p.project_name as projectName,
  46. p.project_usage as projectUsage,
  47. p.province as province,
  48. p.city as city,
  49. p.district as district,
  50. p.num as num,
  51. p.actual_num as actualNum,
  52. p.address as address,
  53. p.start_date as startDate,
  54. p.end_date as endDate,
  55. p.region_id as regionId,
  56. p.pp_company_id as ppCompanyId,
  57. p.pp_contact_id as ppContactId,
  58. p.save as save,
  59. r.area_name as regionName,
  60. ui.name as userName,
  61. pc.name as companyName
  62. FROM project p
  63. LEFT JOIN region r ON p.region_id = r.id
  64. LEFT JOIN user_info ui ON r.user_id = ui.user_id
  65. LEFT JOIN property_company pc ON p.pp_company_id = pc.id
  66. WHERE 1 = 1
  67. <if test="request.provinceCode!=null and request.provinceCode!=''">
  68. and p.province_code= #{request.provinceCode,jdbcType=VARCHAR}
  69. </if>
  70. <if test="request.cityCode!=null and request.cityCode!=''">
  71. and p.city_code = #{request.cityCode,jdbcType=VARCHAR}
  72. </if>
  73. <if test="request.districtCode!=null and request.districtCode!=''">
  74. and p.district_code = #{request.districtCode,jdbcType=VARCHAR}
  75. </if>
  76. <if test="request.regionId!=null and request.regionId!=''">
  77. and p.region_id = #{request.regionId,jdbcType=BIGINT}
  78. </if>
  79. <if test="request.userId!=null and request.userId!=''">
  80. and r.user_id = #{request.userId,jdbcType=BIGINT}
  81. </if>
  82. <if test="request.condition!=null and request.condition!=''">
  83. and (p.project_name like #{request.condition,jdbcType=VARCHAR}
  84. or p.project_code like #{request.condition,jdbcType=VARCHAR}
  85. or p.address like #{request.condition,jdbcType=VARCHAR})
  86. </if>
  87. <if test="request.projectStatus!=null and request.projectStatus!=''">
  88. and p.project_status = #{request.projectStatus,jdbcType=VARCHAR}
  89. </if>
  90. </select>
  91. <!-- 根据甲方公司ID和项目状态查询公司项目管理列表-->
  92. <select id="findCompanyListByCondition" resultType="cn.com.ty.lift.business.project.dao.entity.model.ProjectResponse" parameterType="cn.com.ty.lift.business.project.dao.entity.model.ProjectRequest" >
  93. SELECT
  94. a.project_code as projectCode,
  95. a.project_name as projectName,
  96. a.province as province,
  97. a.city as city,
  98. a.district as district,
  99. a.num as num,
  100. a.actual_num as actualNum,
  101. a.address as address,
  102. a.start_date as startDate,
  103. a.end_date as endDate,
  104. b.name as contactName,
  105. b.telephone as contactTelephone
  106. FROM project a, property_contact b
  107. WHERE a.pp_contact_id = b.id
  108. <if test="request.ppCompanyId!=null and request.ppCompanyId!=''">
  109. AND a.pp_company_id = #{request.ppCompanyId,jdbcType=BIGINT}
  110. </if>
  111. <if test="request.ppContactId!=null and request.ppContactId!=''">
  112. AND a.pp_contact_id = #{request.ppContactId,jdbcType=BIGINT}
  113. </if>
  114. <!--查询项目状态为2:服务中的项目-->
  115. <if test="request.projectStatus!=null and request.projectStatus!='' and request.projectStatus == 2">
  116. AND a.project_status = #{request.projectStatus,jdbcType=TINYINT}
  117. </if>
  118. <!--查询项目状态为3、4:停止服务和逾期的项目-->
  119. <if test="request.projectStatus!=null and request.projectStatus!='' and request.projectStatus == 4">
  120. AND (a.project_status = 3 or a.project_status = 4)
  121. </if>
  122. </select>
  123. <!--根据区域id或维保公司id查询项目id和名称列表 -->
  124. <select id="findProjectListByRegionId" resultType="cn.com.ty.lift.business.project.dao.entity.model.ProjectIDResponse" parameterType="cn.com.ty.lift.business.project.dao.entity.model.ProjectRequest">
  125. SELECT
  126. id AS projectId,
  127. project_name AS projectName
  128. FROM project
  129. WHERE 1=1
  130. <if test="request.regionId!=null and request.regionId!=''">
  131. AND region_id = #{request.regionId,jdbcType=BIGINT}
  132. </if>
  133. <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
  134. AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
  135. </if>
  136. </select>
  137. </mapper>