<?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.javaweb.geo.mapper.HolePersonMapper">
|
|
<resultMap type="HolePerson" id="HolePersonResult">
|
<result property="ids" column="ids" />
|
<result property="code" column="code" />
|
<result property="projectId" column="project_id" />
|
<result property="holeId" column="hole_id" />
|
<result property="type" column="type" />
|
<result property="recordPerson" column="record_person" />
|
<result property="operatePerson" column="operate_person" />
|
<result property="recordPersonName" column="record_person_name" />
|
<result property="testType" column="test_type" />
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP" />
|
<result property="isDeleted" column="is_deleted" />
|
<!--select子查询, column 传给子查询的参数-->
|
<!-- <collection property="holeMediaList" ofType="com.javaweb.geo.domain.HoleMedia" select="queryDetail" column="ids" />-->
|
</resultMap>
|
|
<resultMap type="HoleMedia" id="HoleMediaResult">
|
<result property="ids" column="ids" />
|
<result property="recordId" column="record_id" />
|
<result property="projectId" column="project_id" />
|
<result property="name" column="name" />
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP" />
|
<result property="type" column="type" />
|
<result property="internetPath" column="internet_path" />
|
<result property="createUser" column="create_user" />
|
<result property="uploadUser" column="upload_user" />
|
</resultMap>
|
|
<!--子查询的sql-->
|
<select id="queryDetail" resultMap="HoleMediaResult">
|
SELECT * FROM js_hole_media where record_id = #{ids}
|
</select>
|
|
<sql id="selectHolePersonVo">
|
select ids,code, project_id, hole_id, type, record_person ,operate_person, test_type, create_time, is_deleted from js_hole_person
|
</sql>
|
|
<select id="selectHolePersonList" parameterType="HolePerson" resultMap="HolePersonResult">
|
select
|
a.ids,
|
a.code,
|
a.project_id,
|
a.hole_id,
|
a.type,
|
a.record_person ,
|
u.real_name AS record_person_name,
|
a.operate_person,
|
a.test_type,
|
a.create_time,
|
a.is_deleted
|
from js_hole_person a LEFT JOIN js_company_user u ON a.record_person = u.ids
|
<where>
|
<if test="code != null and code != ''"> and a.code = #{code}</if>
|
<if test="projectId != null and projectId != ''"> and a.project_id = #{projectId}</if>
|
<if test="holeId != null and holeId != ''"> and a.hole_id = #{holeId}</if>
|
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
<if test="recordPerson != null and recordPerson != ''"> and a.record_person = #{recordPerson}</if>
|
<if test="operatePerson != null and operatePerson != ''"> and a.operate_person = #{operatePerson}</if>
|
<if test="testType != null and testType != ''"> and a.test_type = #{testType}</if>
|
<if test="isDeleted != null and isDeleted != ''"> and a.is_deleted = #{isDeleted}</if>
|
</where>
|
</select>
|
|
<select id="selectHolePersonById" parameterType="String" resultMap="HolePersonResult">
|
select
|
a.ids,
|
a.code,
|
a.project_id,
|
a.hole_id,
|
a.type,
|
a.record_person ,
|
u.real_name AS record_person_name,
|
a.operate_person,
|
a.test_type,
|
a.create_time,
|
a.is_deleted
|
from js_hole_person a LEFT JOIN js_company_user u ON a.record_person = u.ids
|
where a.ids = #{ids}
|
</select>
|
|
<select id="selectHolePersonByHoleId" parameterType="String" resultMap="HolePersonResult">
|
<include refid="selectHolePersonVo"/> where hole_id = #{holeId}
|
</select>
|
|
<select id="selectHolePersonByProjectId" parameterType="String" resultMap="HolePersonResult">
|
<include refid="selectHolePersonVo"/> WHERE project_id = #{projectId}
|
</select>
|
|
<insert id="insertHolePerson" parameterType="HolePerson">
|
insert into js_hole_person
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">ids,</if>
|
<if test="code != null and code != ''">code,</if>
|
<if test="projectId != null and projectId != ''">project_id,</if>
|
<if test="holeId != null and holeId != ''">hole_id,</if>
|
<if test="type != null and type != ''">type,</if>
|
<if test="recordPerson != null and recordPerson != ''">record_person,</if>
|
<if test="operatePerson != null and operatePerson != ''">operate_person,</if>
|
<if test="testType != null and testType != ''">test_type,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="isDeleted != null and isDeleted != ''">is_deleted,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">#{ids},</if>
|
<if test="code != null and code != ''">#{code},</if>
|
<if test="projectId != null and projectId != ''">#{projectId},</if>
|
<if test="holeId != null and holeId != ''">#{holeId},</if>
|
<if test="type != null and type != ''">#{type},</if>
|
<if test="recordPerson != null and recordPerson != ''">#{recordPerson},</if>
|
<if test="operatePerson != null and operatePerson != ''">#{operatePerson},</if>
|
<if test="testType != null and testType != ''">#{testType},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if>
|
</trim>
|
</insert>
|
|
<insert id="insertHolePersonList" parameterType="java.util.List">
|
insert into js_hole_person
|
(ids,code, project_id, hole_id, type, record_person ,operate_person, test_type, create_time, is_deleted)
|
VALUES
|
<foreach collection="list" item="item" separator =",">
|
(#{item.ids}, #{item.code}, #{item.projectId},#{item.holeId},#{item.type},#{item.recordPerson},#{item.operatePerson},#{item.testType},#{item.createTime},#{item.isDeleted})
|
</foreach >
|
</insert>
|
|
<update id="updateHolePerson" parameterType="HolePerson">
|
update js_hole_person
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="code != null and code != ''">code = #{code},</if>
|
<if test="projectId != null and projectId != ''">project_id = #{projectId},</if>
|
<if test="holeId != null and holeId != ''">hole_id = #{holeId},</if>
|
<if test="type != null and type != ''">type = #{type},</if>
|
<if test="recordPerson != null and recordPerson != ''">record_person = #{recordPerson},</if>
|
<if test="operatePerson != null and operatePerson != ''">operate_person = #{operatePerson},</if>
|
<if test="testType != null and testType != ''">test_type = #{testType},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="isDeleted != null and isDeleted != ''">is_deleted = #{isDeleted},</if>
|
</trim>
|
where ids = #{ids}
|
</update>
|
|
<delete id="deleteHolePersonById" parameterType="String">
|
delete from js_hole_person where ids = #{ids}
|
</delete>
|
|
<delete id="deleteHolePersonByIds" parameterType="String">
|
delete from js_hole_person where ids in
|
<foreach item="ids" collection="array" open="(" separator="," close=")">
|
#{ids}
|
</foreach>
|
</delete>
|
|
</mapper>
|