<?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.ProjectMapper">
|
|
<resultMap type="Project" id="ProjectResult">
|
<result property="ids" column="ids" />
|
<result property="address" column="address" />
|
<result property="city" column="city" />
|
<result property="code" column="code" />
|
<result property="companyId" column="company_id" />
|
<result property="companyName" column="company_name" />
|
<result property="createTime" column="create_time" />
|
<result property="endTime" column="end_time" />
|
<result property="district" column="district" />
|
<result property="fullName" column="full_name" />
|
<result property="laborUnit" column="labor_unit" />
|
<result property="leader" column="leader" />
|
<result property="leaderName" column="leader_name" />
|
<result property="owner" column="owner" />
|
<result property="province" column="province" />
|
<result property="serialNumber" column="serial_number" />
|
<result property="describe" column="describe" />
|
<result property="status" column="status" />
|
<result property="isDeleted" column="is_deleted" />
|
<result property="statusChangeUser" column="status_change_user" />
|
<result property="statusChangeReason" column="status_change_reason" />
|
<result property="dataSource" column="data_source" />
|
</resultMap>
|
|
<sql id="selectProjectVo">
|
select ids, address, city, code, company_id, create_time,end_time, district, full_name, labor_unit, leader, owner, province, serial_number, 'describe', status, is_deleted, status_change_user, status_change_reason, data_source from js_project
|
|
</sql>
|
|
<select id="selectProjectList" parameterType="Project" resultMap="ProjectResult">
|
<!-- <include refid="selectProjectVo"/>-->
|
select
|
p.ids,
|
p.address,
|
p.city,
|
p.code,
|
p.company_id,
|
c.full_name AS company_name,
|
p.create_time,
|
p.end_time,
|
p.district,
|
p.full_name,
|
p.labor_unit,
|
p.leader,
|
u.real_name AS leader_name,
|
p.owner,
|
p.province,
|
p.serial_number,
|
'p.describe',
|
p.status,
|
p.is_deleted,
|
p.status_change_user,
|
p.status_change_reason,
|
p.data_source
|
FROM
|
js_project p
|
LEFT JOIN js_company_user u ON p.leader = u.ids
|
LEFT JOIN js_company c ON p.company_id = c.ids
|
<where>
|
p.is_deleted='0'
|
<if test="address != null and address != ''"> and p.address = #{address}</if>
|
<if test="city != null "> and p.city = #{city}</if>
|
<if test="code != null and code != ''"> and p.code = #{code}</if>
|
<if test="companyId != null "> and p.company_id = #{companyId}</if>
|
<if test="district != null and district != ''"> and p.district = #{district}</if>
|
<if test="fullName != null and fullName != ''"> and p.full_name like concat('%', #{fullName}, '%')</if>
|
<if test="laborUnit != null and laborUnit != ''"> and p.labor_unit = #{laborUnit}</if>
|
<if test="leader != null and leader != ''"> and p.leader = #{leader}</if>
|
<if test="owner != null and owner != ''"> and p.owner = #{owner}</if>
|
<if test="province != null and province != ''"> and p.province = #{province}</if>
|
<if test="serialNumber != null and serialNumber != ''"> and p.serial_number = #{serialNumber}</if>
|
<if test="describe != null and describe != ''"> and p.describe = #{describe}</if>
|
<if test="status != null and status != ''"> and p.status = #{status}</if>
|
<if test="isDeleted != null and isDeleted != ''"> and p.is_deleted = #{isDeleted}</if>
|
ORDER BY p.create_time DESC
|
</where>
|
</select>
|
|
<select id="selectProjectById" parameterType="String" resultMap="ProjectResult">
|
select
|
p.ids,
|
p.address,
|
p.city,
|
p.code,
|
p.company_id,
|
c.full_name AS company_name,
|
p.create_time,
|
p.end_time,
|
p.district,
|
p.full_name,
|
p.labor_unit,
|
p.leader,
|
u.real_name AS leader_name,
|
p.owner,
|
p.province,
|
p.serial_number,
|
'p.describe',
|
p.status,
|
p.is_deleted,
|
p.status_change_user,
|
p.status_change_reason,
|
p.data_source
|
FROM
|
js_project p
|
LEFT JOIN js_company_user u ON p.leader = u.ids
|
LEFT JOIN js_company c ON p.company_id = c.ids
|
WHERE p.is_deleted='0' and p.ids = #{ids}
|
</select>
|
|
<select id="selectProjectBySerialNumber" resultMap="ProjectResult">
|
<include refid="selectProjectVo"/>
|
where serial_number = #{serialNumber} and is_deleted='0'
|
</select>
|
|
<select id="selectAllProjectNum" resultType="java.lang.Long">
|
SELECT count(ids) FROM js_project WHERE is_deleted = '0'
|
</select>
|
|
<select id="selectProjectNum" resultType="java.lang.Long">
|
SELECT count(ids) FROM js_project WHERE `status` = '0' AND is_deleted = '0'
|
</select>
|
|
<select id="proExceptionList" resultMap="ProjectResult">
|
SELECT
|
p.ids,
|
p.full_name,
|
c.full_name as company_name,
|
u.real_name as leader_name
|
FROM
|
js_project p,
|
js_company_user u,
|
js_company c
|
WHERE
|
p.leader = u.ids
|
AND p.company_id = c.ids
|
AND p.is_deleted = '0'
|
AND p.ids = ANY ( SELECT project_id FROM js_handle_exception WHERE is_delete = '0' GROUP BY project_id )
|
</select>
|
|
<insert id="insertProject" parameterType="Project">
|
insert into js_project
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">ids,</if>
|
<if test="address != null and address != ''">address,</if>
|
<if test="city != null ">city,</if>
|
<if test="code != null and code != ''">code,</if>
|
<if test="companyId != null ">company_id,</if>
|
<if test="createTime != null ">create_time,</if>
|
<if test="district != null and district != ''">district,</if>
|
<if test="fullName != null and fullName != ''">full_name,</if>
|
<if test="laborUnit != null and laborUnit != ''">labor_unit,</if>
|
<if test="leader != null and leader != ''">leader,</if>
|
<if test="owner != null and owner != ''">owner,</if>
|
<if test="province != null and province != ''">province,</if>
|
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
|
<if test="describe != null and describe != ''">`describe`,</if>
|
<if test="status != null and status != ''">status,</if>
|
<if test="isDeleted != null and isDeleted != ''">is_deleted,</if>
|
<if test="statusChangeUser != null and statusChangeUser != ''">status_change_user,</if>
|
<if test="statusChangeReason != null and statusChangeReason != ''">status_change_reason,</if>
|
<if test="dataSource != null and dataSource != ''">data_source,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">#{ids},</if>
|
<if test="address != null and address != ''">#{address},</if>
|
<if test="city != null ">#{city},</if>
|
<if test="code != null and code != ''">#{code},</if>
|
<if test="companyId != null ">#{companyId},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
<if test="district != null and district != ''">#{district},</if>
|
<if test="fullName != null and fullName != ''">#{fullName},</if>
|
<if test="laborUnit != null and laborUnit != ''">#{laborUnit},</if>
|
<if test="leader != null and leader != ''">#{leader},</if>
|
<if test="owner != null and owner != ''">#{owner},</if>
|
<if test="province != null and province != ''">#{province},</if>
|
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
|
<if test="describe != null and describe != ''">#{describe},</if>
|
<if test="status != null and status != ''">#{status},</if>
|
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if>
|
<if test="statusChangeUser != null and statusChangeUser != ''">#{statusChangeUser},</if>
|
<if test="statusChangeReason != null and isDeleted != ''">#{statusChangeReason},</if>
|
<if test="dataSource != null and dataSource != ''">#{dataSource},</if>
|
</trim>
|
</insert>
|
|
<update id="updateProject" parameterType="Project">
|
update js_project
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="address != null and address != ''">address = #{address},</if>
|
<if test="city != null ">city = #{city},</if>
|
<if test="code != null and code != ''">code = #{code},</if>
|
<if test="companyId != null ">company_id = #{companyId},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
<if test="district != null and district != ''">district = #{district},</if>
|
<if test="fullName != null and fullName != ''">full_name = #{fullName},</if>
|
<if test="laborUnit != null and laborUnit != ''">labor_unit = #{laborUnit},</if>
|
<if test="leader != null and leader != ''">leader = #{leader},</if>
|
<if test="owner != null and owner != ''">owner = #{owner},</if>
|
<if test="province != null and province != ''">province = #{province},</if>
|
<if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
|
<if test="describe != null and describe != ''">`describe` = #{describe},</if>
|
<if test="status != null and status != ''">status = #{status},</if>
|
<if test="isDeleted != null and isDeleted != ''">is_deleted = #{isDeleted},</if>
|
<if test="statusChangeUser != null and statusChangeUser != ''">status_change_user = #{statusChangeUser},</if>
|
<if test="statusChangeReason != null and statusChangeReason != ''">status_change_reason = #{statusChangeReason},</if>
|
<if test="dataSource != null and dataSource != ''">data_source = #{dataSource},</if>
|
</trim>
|
where ids = #{ids}
|
</update>
|
|
<delete id="deleteProjectById" parameterType="String">
|
delete from js_project where ids = #{ids}
|
</delete>
|
|
<delete id="deleteProjectByIds" parameterType="String">
|
delete from js_project where ids in
|
<foreach item="ids" collection="array" open="(" separator="," close=")">
|
#{ids}
|
</foreach>
|
</delete>
|
|
</mapper>
|