95 lines
4.5 KiB
XML
95 lines
4.5 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.bonus.tool.mapper.TbSubPerfMapper">
|
|
<insert id="addTbSubPerf" useGeneratedKeys="true" keyProperty="id">
|
|
insert into tb_sub_perf
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="subId != null and subId != ''">sub_id,</if>
|
|
<if test="proName != null and proName != ''">pro_name,</if>
|
|
<if test="consUnit != null ">cons_unit,</if>
|
|
<if test="startTime != null">start_time,</if>
|
|
<if test="endTime != null ">end_time,</if>
|
|
<if test="htRemark != null and htRemark != ''">ht_remark,</if>
|
|
<if test="money != null ">money,</if>
|
|
<if test="createTime != null ">create_time,</if>
|
|
<if test="createUser != null and createUser != ''">create_user,</if>
|
|
<if test="voltage != null and voltage != ''">voltage,</if>
|
|
del_flag
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="subId != null and subId != ''">#{subId},</if>
|
|
<if test="proName != null and proName != ''">#{proName},</if>
|
|
<if test="consUnit != null ">#{consUnit},</if>
|
|
<if test="startTime != null ">#{startTime},</if>
|
|
<if test="endTime != null ">#{endTime},</if>
|
|
<if test="htRemark != null and htRemark != ''">#{htRemark},</if>
|
|
<if test="money != null ">#{money},</if>
|
|
<if test="createTime != null ">#{createTime},</if>
|
|
<if test="createUser != null ">#{createUser},</if>
|
|
<if test="voltage != null ">#{voltage},</if>
|
|
0
|
|
</trim>
|
|
</insert>
|
|
<update id="updateTbSubPerf">
|
|
update tb_sub_perf
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="subId != null">sub_id = #{subId},</if>
|
|
<if test="proName != null">pro_name = #{proName},</if>
|
|
<if test="consUnit != null">cons_unit = #{consUnit},</if>
|
|
<if test="startTime != null">start_time = #{startTime},</if>
|
|
<if test="endTime != null">end_time = #{endTime},</if>
|
|
<if test="htRemark != null">ht_remark = #{htRemark},</if>
|
|
<if test="money != null">money = #{money},</if>
|
|
<if test="voltage != null">voltage = #{voltage},</if>
|
|
<if test="updateUser != null">update_user = #{updateUser},</if>
|
|
update_time = now()
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
<delete id="delTbSubPerf">
|
|
update tb_sub_perf set del_flag = 1 where id = #{id}
|
|
</delete>
|
|
|
|
<select id="getTbSubPerfList" resultType="com.bonus.tool.dto.TbSubPerfVo">
|
|
select id as id,sub_id as subId,pro_name as proName,cons_unit as consUnit,start_time as startTime,
|
|
end_time as endTime,ht_remark as htRemark,money as money,voltage as voltage
|
|
from tb_sub_perf where del_flag=0
|
|
<if test="proName != '' and proName != null">and pro_name = #{proName}</if>
|
|
<if test="subId != '' and subId != null">and sub_id = #{subId}</if>
|
|
<if test="voltage != '' and voltage != null">and voltage = #{voltage}</if>
|
|
<if test="startTime != null and endTime != null">
|
|
and start_time BETWEEN STR_TO_DATE(#{startTime}, '%Y-%m-%d') AND STR_TO_DATE(#{endTime}, '%Y-%m-%d')
|
|
</if>
|
|
</select>
|
|
<select id="getTbSubPerfById" resultType="com.bonus.tool.dto.TbSubPerfVo">
|
|
select id as id,sub_id as subId,pro_name as proName,cons_unit as consUnit,start_time as startTime,
|
|
end_time as endTime,ht_remark as htRemark,money as money,voltage as voltage
|
|
from tb_sub_perf where id=#{id}
|
|
</select>
|
|
<select id="getTbSubPerfByProName" resultType="com.bonus.tool.dto.TbSubPerfVo">
|
|
select id as id,sub_id as subId,pro_name as proName,cons_unit as consUnit,start_time as startTime,
|
|
end_time as endTime,ht_remark as htRemark,money as money,voltage as voltage
|
|
from tb_sub_perf where pro_name=#{proName} and sub_id=#{subId} and del_flag=0
|
|
</select>
|
|
<select id="getTbSubPerfListByPersonId" resultType="com.bonus.tool.dto.TbSubPerfVo">
|
|
select
|
|
tcp.pro_name,
|
|
tcp.start_time,
|
|
tcp.end_time,
|
|
tcp.voltage
|
|
FROM
|
|
tb_sub_people tsp
|
|
LEFT JOIN tb_company_perf_rel tcpr ON tcpr.key_user = tsp.id and source = '2'
|
|
LEFT JOIN tb_sub_perf tcp ON tcp.id = tcpr.perf_id and tcp.del_flag = 0
|
|
WHERE tsp.del_flag = 0 and tcp.id is not null
|
|
<if test="personId != '' and personId != null">and tsp.id = #{personId}</if>
|
|
<if test="proName != '' and proName != null">and tcp.pro_name = #{proName}</if>
|
|
<if test="subId != '' and subId != null">and tcp.sub_id = #{subId}</if>
|
|
<if test="voltage != '' and voltage != null">and tcp.voltage = #{voltage}</if>
|
|
<if test="startTime != null and endTime != null">
|
|
and tcp.start_time BETWEEN STR_TO_DATE(#{startTime}, '%Y-%m-%d') AND STR_TO_DATE(#{endTime}, '%Y-%m-%d')
|
|
</if>
|
|
</select>
|
|
</mapper>
|