123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="cn.com.ty.lift.business.project.dao.mapper.ProjectMapper" >
- <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.project.dao.entity.Project" >
- <id column="id" property="id" jdbcType="BIGINT" />
- <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
- <result column="pp_company_id" property="ppCompanyId" jdbcType="BIGINT" />
- <result column="pp_contact_id" property="ppContactId" jdbcType="BIGINT" />
- <result column="project_code" property="projectCode" jdbcType="CHAR" />
- <result column="project_name" property="projectName" jdbcType="VARCHAR" />
- <result column="province_code" property="provinceCode" jdbcType="CHAR" />
- <result column="province" property="province" jdbcType="VARCHAR" />
- <result column="city_code" property="cityCode" jdbcType="CHAR" />
- <result column="city" property="city" jdbcType="VARCHAR" />
- <result column="district_code" property="districtCode" jdbcType="CHAR" />
- <result column="district" property="district" jdbcType="VARCHAR" />
- <result column="address" property="address" jdbcType="VARCHAR" />
- <result column="num" property="num" jdbcType="INTEGER" />
- <result column="actual_num" property="actualNum" jdbcType="INTEGER" />
- <result column="project_usage" property="projectUsage" jdbcType="TINYINT" />
- <result column="start_date" property="startDate" jdbcType="DATE" />
- <result column="end_date" property="endDate" jdbcType="DATE" />
- <result column="project_status" property="projectStatus" jdbcType="TINYINT" />
- <result column="remarks" property="remarks" jdbcType="VARCHAR" />
- <result column="is_locked" property="isLocked" jdbcType="TINYINT" />
- <result column="creator_id" property="creatorId" jdbcType="BIGINT" />
- <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
- <result column="evaluate" property="evaluate" jdbcType="INTEGER" />
- <result column="end_remarks" property="endRemarks" jdbcType="VARCHAR" />
- <result column="if_monitor" property="ifMonitor" jdbcType="INTEGER" />
- <result column="all_project" property="allProject" jdbcType="INTEGER" />
- <result column="region_id" property="regionId" jdbcType="BIGINT" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, mt_company_id, pp_company_id, pp_contact_id, project_code, project_name, province_code,
- province, city_code, city, district_code, district, address, num, actual_num, project_usage,
- start_date, end_date, project_status, remarks, is_locked, creator_id, create_date,
- evaluate, end_remarks, if_monitor, all_project, region_id
- </sql>
- <!-- 根据省,市,区,区域,区域主管,项目名称、项目编号、甲方名称、项目地址查询项目管理列表-->
- <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" >
- SELECT
- p.id as id,
- p.project_code as projectCode,
- p.project_name as projectName,
- p.project_usage as projectUsage,
- p.province as province,
- p.city as city,
- p.district as district,
- p.num as num,
- p.actual_num as actualNum,
- p.address as address,
- p.start_date as startDate,
- p.end_date as endDate,
- p.region_id as regionId,
- p.pp_company_id as ppCompanyId,
- p.pp_contact_id as ppContactId,
- p.save as save,
- r.area_name as regionName,
- ui.name as userName,
- pc.name as companyName
- FROM project p
- LEFT JOIN region r ON p.region_id = r.id
- LEFT JOIN user_info ui ON r.user_id = ui.user_id
- LEFT JOIN property_company pc ON p.pp_company_id = pc.id
- WHERE 1 = 1
- <if test="request.provinceCode!=null and request.provinceCode!=''">
- and p.province_code= #{request.provinceCode,jdbcType=VARCHAR}
- </if>
- <if test="request.cityCode!=null and request.cityCode!=''">
- and p.city_code = #{request.cityCode,jdbcType=VARCHAR}
- </if>
- <if test="request.districtCode!=null and request.districtCode!=''">
- and p.district_code = #{request.districtCode,jdbcType=VARCHAR}
- </if>
- <if test="request.regionId!=null and request.regionId!=''">
- and p.region_id = #{request.regionId,jdbcType=BIGINT}
- </if>
- <if test="request.userId!=null and request.userId!=''">
- and r.user_id = #{request.userId,jdbcType=BIGINT}
- </if>
- <if test="request.condition!=null and request.condition!=''">
- and (p.project_name like #{request.condition,jdbcType=VARCHAR}
- or p.project_code like #{request.condition,jdbcType=VARCHAR}
- or p.address like #{request.condition,jdbcType=VARCHAR})
- </if>
- <if test="request.projectStatus!=null and request.projectStatus!=''">
- and p.project_status = #{request.projectStatus,jdbcType=VARCHAR}
- </if>
- </select>
- <!-- 根据甲方公司ID和项目状态查询公司项目管理列表-->
- <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" >
- SELECT
- a.project_code as projectCode,
- a.project_name as projectName,
- a.province as province,
- a.city as city,
- a.district as district,
- a.num as num,
- a.actual_num as actualNum,
- a.address as address,
- a.start_date as startDate,
- a.end_date as endDate,
- b.name as contactName,
- b.telephone as contactTelephone
- FROM project a, property_contact b
- WHERE a.pp_contact_id = b.id
- <if test="request.ppCompanyId!=null and request.ppCompanyId!=''">
- AND a.pp_company_id = #{request.ppCompanyId,jdbcType=BIGINT}
- </if>
- <if test="request.ppContactId!=null and request.ppContactId!=''">
- AND a.pp_contact_id = #{request.ppContactId,jdbcType=BIGINT}
- </if>
- <!--查询项目状态为2:服务中的项目-->
- <if test="request.projectStatus!=null and request.projectStatus!='' and request.projectStatus == 2">
- AND a.project_status = #{request.projectStatus,jdbcType=TINYINT}
- </if>
- <!--查询项目状态为3、4:停止服务和逾期的项目-->
- <if test="request.projectStatus!=null and request.projectStatus!='' and request.projectStatus == 4">
- AND (a.project_status = 3 or a.project_status = 4)
- </if>
- </select>
- <!--根据区域id或维保公司id查询项目id和名称列表 -->
- <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">
- SELECT
- id AS projectId,
- project_name AS projectName
- FROM project
- WHERE 1=1
- <if test="request.regionId!=null and request.regionId!=''">
- AND region_id = #{request.regionId,jdbcType=BIGINT}
- </if>
- <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
- AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
- </if>
- </select>
- </mapper>
|