jhprjv2/yanzhu-jh/src/main/resources/mapper/device/PitmonitSouthsmosSurveypoin...

156 lines
8.8 KiB
XML

<?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.yanzhu.jh.device.mapper.PitmonitSouthsmosSurveypointMapper">
<resultMap type="PitmonitSouthsmosSurveypoint" id="PitmonitSouthsmosSurveypointResult">
<result property="id" column="id" />
<result property="cfgId" column="cfgId" />
<result property="spId" column="spId" />
<result property="groupId" column="groupId" />
<result property="groupName" column="groupName" />
<result property="meId" column="meId" />
<result property="meName" column="meName" />
<result property="meNameEn" column="meNameEn" />
<result property="modifyDate" column="modifyDate" />
<result property="name" column="name" />
<result property="position" column="position" />
<result property="dataSource" column="dataSource" />
<result property="createDate" column="createDate" />
<result property="status" column="status" />
<result property="state" column="state" />
<result property="remark" column="remark" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deptName" column="deptName"/>
<result property="projectId" column="projectId"/>
<result property="subDeptId" column="subDeptId"/>
<result property="prjName" column="prjName"/>
</resultMap>
<sql id="selectDevPitmonitSouthsmosSurveypointVo">
select id, cfgId, spId, groupId, groupName, meId, meName, meNameEn, modifyDate, name, position, dataSource, createDate, status,
state, remark, is_del, create_by, create_time, update_by, update_time from dev_pitmonit_southsmos_surveypoint
</sql>
<select id="selectDevPitmonitSouthsmosSurveypointList" parameterType="PitmonitSouthsmosSurveypoint" resultMap="PitmonitSouthsmosSurveypointResult">
SELECT a.*,c.unitName AS deptName,b.project_id AS projectId,p.projectName prjName,c.unitName AS deptName,b.sub_dept_id subDeptId
FROM dev_pitmonit_southsmos_surveypoint a
JOIN sur_project_pit_monit_cfg b ON a.cfgId = b.id
JOIN sur_project p ON b.project_id =p.id
JOIN sur_project_unit_info c ON b.sub_dept_id = c.unitId AND b.project_id = c.projectId
WHERE a.is_del = 0
<if test="cfgId != null "> and a.cfgId = #{cfgId}</if>
<if test="spId != null "> and a.spId = #{spId}</if>
<if test="groupId != null "> and a.groupId = #{groupId}</if>
<if test="groupName != null and groupName != ''"> and a.groupName like concat('%', #{groupName}, '%')</if>
<if test="meId != null "> and a.meId = #{meId}</if>
<if test="meName != null and meName != ''"> and a.meName like concat('%', #{meName}, '%')</if>
<if test="meNameEn != null and meNameEn != ''"> and a.meNameEn = #{meNameEn}</if>
<if test="modifyDate != null "> and a.modifyDate = #{modifyDate}</if>
<if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
<if test="position != null and position != ''"> and a.position = #{position}</if>
<if test="dataSource != null "> and a.dataSource = #{dataSource}</if>
<if test="createDate != null "> and a.createDate = #{createDate}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="state != null "> and a.state = #{state}</if>
<if test="projectId != null and projectId>0 "> and b.project_id= #{projectId}</if>
<if test="subDeptId != null and subDeptId>0 "> and b.sub_dept_id= #{subDeptId}</if>
order by spId
</select>
<select id="selectDevPitmonitSouthsmosSurveypointById" parameterType="Long" resultMap="PitmonitSouthsmosSurveypointResult">
<include refid="selectDevPitmonitSouthsmosSurveypointVo"/>
where id = #{id}
</select>
<insert id="insertDevPitmonitSouthsmosSurveypoint" parameterType="DevPitmonitSouthsmosSurveypoint" useGeneratedKeys="true" keyProperty="id">
insert into dev_pitmonit_southsmos_surveypoint
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cfgId != null">cfgId,</if>
<if test="spId != null">spId,</if>
<if test="groupId != null">groupId,</if>
<if test="groupName != null">groupName,</if>
<if test="meId != null">meId,</if>
<if test="meName != null">meName,</if>
<if test="meNameEn != null">meNameEn,</if>
<if test="modifyDate != null">modifyDate,</if>
<if test="name != null">name,</if>
<if test="position != null">position,</if>
<if test="dataSource != null">dataSource,</if>
<if test="createDate != null">createDate,</if>
<if test="status != null">status,</if>
<if test="state != null">state,</if>
<if test="remark != null">remark,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cfgId != null">#{cfgId},</if>
<if test="spId != null">#{spId},</if>
<if test="groupId != null">#{groupId},</if>
<if test="groupName != null">#{groupName},</if>
<if test="meId != null">#{meId},</if>
<if test="meName != null">#{meName},</if>
<if test="meNameEn != null">#{meNameEn},</if>
<if test="modifyDate != null">#{modifyDate},</if>
<if test="name != null">#{name},</if>
<if test="position != null">#{position},</if>
<if test="dataSource != null">#{dataSource},</if>
<if test="createDate != null">#{createDate},</if>
<if test="status != null">#{status},</if>
<if test="state != null">#{state},</if>
<if test="remark != null">#{remark},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDevPitmonitSouthsmosSurveypoint" parameterType="PitmonitSouthsmosSurveypoint">
update dev_pitmonit_southsmos_surveypoint
<trim prefix="SET" suffixOverrides=",">
<if test="cfgId != null">cfgId = #{cfgId},</if>
<if test="spId != null">spId = #{spId},</if>
<if test="groupId != null">groupId = #{groupId},</if>
<if test="groupName != null">groupName = #{groupName},</if>
<if test="meId != null">meId = #{meId},</if>
<if test="meName != null">meName = #{meName},</if>
<if test="meNameEn != null">meNameEn = #{meNameEn},</if>
<if test="modifyDate != null">modifyDate = #{modifyDate},</if>
<if test="name != null">name = #{name},</if>
<if test="position != null">position = #{position},</if>
<if test="dataSource != null">dataSource = #{dataSource},</if>
<if test="createDate != null">createDate = #{createDate},</if>
<if test="status != null">status = #{status},</if>
<if test="state != null">state = #{state},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDevPitmonitSouthsmosSurveypointById" parameterType="Long">
delete from dev_pitmonit_southsmos_surveypoint where id = #{id}
</delete>
<delete id="deleteDevPitmonitSouthsmosSurveypointByIds" parameterType="String">
delete from dev_pitmonit_southsmos_surveypoint where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>