|
@@ -0,0 +1,99 @@
|
|
|
+<?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="com.hssx.cloudmodel.mapper.ProjectMapper">
|
|
|
+
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.Project">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="project_name" property="projectName" />
|
|
|
+ <result column="project_no" property="projectNo" />
|
|
|
+ <result column="start_time" property="startTime" />
|
|
|
+ <result column="end_time" property="endTime" />
|
|
|
+ <result column="content" property="content" />
|
|
|
+ <result column="creator_id" property="creatorId" />
|
|
|
+ <result column="creator" property="creator" />
|
|
|
+ <result column="is_delete" property="isDelete" />
|
|
|
+ <result column="owner_company" property="ownerCompany" />
|
|
|
+ <result column="owner_company_name" property="ownerCompanyName" />
|
|
|
+ <result column="indate" property="indate" />
|
|
|
+ <result column="manager_id" property="managerId" />
|
|
|
+ <result column="manager" property="manager" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 通用查询结果列 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, project_name, project_no, start_time, end_time, content, creator_id, creator, is_delete, owner_company, owner_company_name, indate, manager_id, manager
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="project_name" property="projectName" />
|
|
|
+ <result column="project_no" property="projectNo" />
|
|
|
+ <result column="creator_id" property="creatorId" />
|
|
|
+ <result column="creator" property="creator" />
|
|
|
+ <result column="is_delete" property="isDelete" />
|
|
|
+ <result column="indate" property="indate" />
|
|
|
+ <result column="manager_id" property="managerId" />
|
|
|
+ <result column="manager" property="manager" />
|
|
|
+ <collection property="models" ofType="com.hssx.cloudmodel.entity.Mould">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="model_no" property="modelNo" />
|
|
|
+ <result column="model_name" property="modelName" />
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="getProjectListByUid" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ p.id id,p.project_name project_name, p.creator creator,p.owner_company owner_company,
|
|
|
+ p.owner_company_name owner_company_name,
|
|
|
+ p.indate indate
|
|
|
+ from
|
|
|
+ tb_project p
|
|
|
+ left join tb_project_user pu
|
|
|
+ on p.id = pu.project_id
|
|
|
+ <where>
|
|
|
+ <if test="currentUser.id != 1">
|
|
|
+ pu.user_id = #{currentUser.id}
|
|
|
+ </if>
|
|
|
+ <if test="keyName != null and keyName != ''">
|
|
|
+ p.project_name like concat('%',#{keyName},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getProjectById" resultMap="BaseResultMapVO">
|
|
|
+ select
|
|
|
+ p.id id, p.project_name project_name, p.project_no project_no, p.creator_id creator_id, p.creator creator, p.owner_company owner_company,
|
|
|
+ p.owner_company_name owner_company_name,p.indate indate,
|
|
|
+ m.model_no model_no,m.model_name model_name
|
|
|
+ from
|
|
|
+ tb_project p
|
|
|
+ left join tb_mould m
|
|
|
+ on p.id = m.project_id
|
|
|
+ where
|
|
|
+ p.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap id="UserResultMap" type="com.hssx.cloudmodel.entity.User">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="username" property="username" />
|
|
|
+ <result column="role_type" property="roleType" />
|
|
|
+ <result column="company_id" property="companyId" />
|
|
|
+ <result column="head_imgurl" property="headImgurl" />
|
|
|
+ <result column="subordinate_type" property="subordinateType" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="getProjectUserById" resultMap="UserResultMap">
|
|
|
+ select
|
|
|
+ u.id id, u.username username, u.indate indate, u.head_imgurl head_imgurl, u.subordinate_type subordinate_type
|
|
|
+ from
|
|
|
+ tb_project_user pu
|
|
|
+ left join
|
|
|
+ tb_user u
|
|
|
+ on
|
|
|
+ pu.user_id = u.id
|
|
|
+ where
|
|
|
+ pu.project_id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|