<?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.thhy.engineering.modules.biz.reciver.mapper.ReciverMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.id as id,
|
t.pro_id as proId,
|
t.segment_id as segmentId,
|
t.reciver_name as reciverName,
|
t.reciver_phone as reciverPhone,
|
t.city_id as cityId,
|
t.address as address,
|
t.create_time as createTime,
|
t.create_user as createUser,
|
t.update_time as updateTime,
|
t.update_user as updateUser,
|
t.remark as remark,
|
t.reciver_unit as reciverUnit
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
t.is_use = 1 AND
|
<if test="proId!=null and proId!=''">
|
t.pro_id = #{proId} AND
|
</if>
|
<if test="segmentId!=null and segmentId!=''">
|
t.segment_id = #{segmentId} AND
|
</if>
|
<if test="reciverName!=null and reciverName!=''">
|
t.reciver_name = #{reciverName} AND
|
</if>
|
<if test="reciverPhone!=null and reciverPhone!=''">
|
t.reciver_phone = #{reciverPhone} AND
|
</if>
|
<if test="cityId!=null and cityId!=''">
|
t.city_id = #{cityId} AND
|
</if>
|
<if test="address!=null and address!=''">
|
t.address = #{address} AND
|
</if>
|
<if test="createTime!=null">
|
t.create_time = #{createTime} AND
|
</if>
|
<if test="createUser!=null and createUser!=''">
|
t.create_user = #{createUser} AND
|
</if>
|
<if test="updateTime!=null">
|
t.update_time = #{updateTime} AND
|
</if>
|
<if test="updateUser!=null and updateUser!=''">
|
t.update_user = #{updateUser} AND
|
</if>
|
<if test="remark!=null and remark!=''">
|
t.remark = #{remark} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.engineering.modules.biz.reciver.entity.Reciver">
|
select <include refid="Base_Column_List" />
|
from sys_reciver t
|
where t.id=#{id}
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from sys_reciver
|
where id=#{id}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.engineering.modules.biz.reciver.entity.ReciverListVo">
|
SELECT
|
<include refid="Base_Column_List" />,
|
sp.pro_name as proName,
|
seg.segment_name as segmentName,
|
(select CONCAT(sc2.`name`,'-',sc1.`name`,'-',sc.`name`) as cityFullName
|
from sys_city sc
|
left join sys_city sc1 on sc1.id = sc.parentid
|
left join sys_city sc2 on sc2.id = sc1.parentid
|
where sc.id = t.city_id) as cityFullName
|
from sys_reciver t
|
left join sys_project sp on sp.pro_id = t.pro_id
|
left join sys_segment seg on seg.segment_id = t.segment_id
|
<where>
|
<trim suffixOverrides=" AND ">
|
t.is_use = 1 AND sp.company_id = #{companyId} AND
|
<if test="proId!=null and proId!=''">
|
t.pro_id = #{proId} AND
|
</if>
|
<if test="segmentId!=null and segmentId!=''">
|
t.segment_id = #{segmentId} AND
|
</if>
|
<if test="reciverName!=null and reciverName!=''">
|
t.reciver_name LIKE concat('%',#{reciverName},'%') AND
|
</if>
|
</trim>
|
</where>
|
order by t.create_time desc
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.engineering.modules.biz.reciver.entity.Reciver">
|
SELECT
|
<include refid="Base_Column_List" />
|
from sys_reciver t
|
where t.is_use = 1
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into sys_reciver
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
id,
|
</if>
|
<if test="proId != null">
|
pro_id,
|
</if>
|
<if test="segmentId != null">
|
segment_id,
|
</if>
|
<if test="reciverName != null">
|
reciver_name,
|
</if>
|
<if test="reciverPhone != null">
|
reciver_phone,
|
</if>
|
<if test="cityId != null">
|
city_id,
|
</if>
|
<if test="address != null">
|
address,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="updateTime != null">
|
update_time,
|
</if>
|
<if test="updateUser != null">
|
update_user,
|
</if>
|
<if test="remark != null">
|
remark,
|
</if>
|
<if test="reciverUnit != null">
|
reciver_unit,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
#{id},
|
</if>
|
<if test="proId != null">
|
#{proId},
|
</if>
|
<if test="segmentId != null">
|
#{segmentId},
|
</if>
|
<if test="reciverName != null">
|
#{reciverName},
|
</if>
|
<if test="reciverPhone != null">
|
#{reciverPhone},
|
</if>
|
<if test="cityId != null">
|
#{cityId},
|
</if>
|
<if test="address != null">
|
#{address},
|
</if>
|
<if test="createTime != null">
|
#{createTime},
|
</if>
|
<if test="createUser != null">
|
#{createUser},
|
</if>
|
<if test="updateTime != null">
|
#{updateTime},
|
</if>
|
<if test="updateUser != null">
|
#{updateUser},
|
</if>
|
<if test="remark != null">
|
#{remark},
|
</if>
|
<if test="reciverUnit != null">
|
#{reciverUnit},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update sys_reciver
|
<set>
|
<if test="proId != null">
|
pro_id=#{proId},
|
</if>
|
<if test="segmentId != null">
|
segment_id=#{segmentId},
|
</if>
|
<if test="reciverName != null">
|
reciver_name=#{reciverName},
|
</if>
|
<if test="reciverPhone != null">
|
reciver_phone=#{reciverPhone},
|
</if>
|
<if test="cityId != null">
|
city_id=#{cityId},
|
</if>
|
<if test="address != null">
|
address=#{address},
|
</if>
|
<if test="createTime != null">
|
create_time=#{createTime},
|
</if>
|
<if test="createUser != null">
|
create_user=#{createUser},
|
</if>
|
<if test="updateTime != null">
|
update_time=#{updateTime},
|
</if>
|
<if test="updateUser != null">
|
update_user=#{updateUser},
|
</if>
|
<if test="remark != null">
|
remark=#{remark},
|
</if>
|
<if test="reciverUnit != null">
|
reciver_unit=#{reciverUnit},
|
</if>
|
</set>
|
where id=#{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update sys_reciver
|
SET is_use = 0
|
where id=#{id}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from sys_reciver
|
where id=#{id}
|
</delete>
|
<select id="reciverInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.reciver.entity.Reciver">
|
select
|
sr.id,
|
sr.reciver_name as reciverName,
|
sr.reciver_phone as reciverPhone,
|
sr.pro_id as proId,
|
sp.pro_name as proName,
|
sr.address as address,
|
sr.reciver_unit as reciverUnit
|
from sys_reciver sr
|
left join sys_project sp on sp.pro_id = sr.pro_id
|
where sr.is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and sp.company_id = #{companyId}
|
</if>
|
</select>
|
|
</mapper>
|