234 lines
8.1 KiB
XML
234 lines
8.1 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.ho.business.mapper.YcValueMapper">
|
||
|
|
|
||
|
|
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
id
|
||
|
|
,group_id,dept_id,
|
||
|
|
station_id,create_time,`type`,
|
||
|
|
digital,`day`
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="selectByPrimaryKey" resultType="com.ho.business.entity.YcValue">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from yc_value
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="selectByStationAndCreateTime" resultType="com.ho.business.entity.YcValue">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from yc_value
|
||
|
|
where station_id = #{stationId}
|
||
|
|
and `day` BETWEEN #{first} and #{current}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectByStationAndDay" resultType="com.ho.business.entity.YcValue">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from yc_value
|
||
|
|
<where>
|
||
|
|
and station_id = #{stationId}
|
||
|
|
and day BETWEEN #{beginDay} and #{endDay}
|
||
|
|
<if test="typeList!=null and typeList.size() !=0">
|
||
|
|
and type in
|
||
|
|
<foreach collection="typeList" item="item" open="(" close=")" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectYearChargeE" resultType="java.math.BigDecimal">
|
||
|
|
SELECT sum(digital) as sum
|
||
|
|
from yc_value
|
||
|
|
WHERE station_id = #{stationId}
|
||
|
|
and type = #{type}
|
||
|
|
and create_time BETWEEN #{beginTime}
|
||
|
|
AND #{endTime}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getStatisticsList" resultType="com.ho.business.vo.resp.StatisticsRespVO">
|
||
|
|
select day as date , digital
|
||
|
|
from yc_value
|
||
|
|
<where>
|
||
|
|
<if test="beginTime != null ">
|
||
|
|
and day >= #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and day <= #{endTime}
|
||
|
|
</if>
|
||
|
|
<if test="stationId != null">
|
||
|
|
and station_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test="groupId != null">
|
||
|
|
and group_id = #{groupId}
|
||
|
|
</if>
|
||
|
|
<if test="deptId != null">
|
||
|
|
and dept_id = #{deptId}
|
||
|
|
</if>
|
||
|
|
<if test="type !=null">
|
||
|
|
and type = #{type}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
order by day
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getListByCondition" resultType="com.ho.business.entity.YcValue">
|
||
|
|
select <include refid="Base_Column_List"/>
|
||
|
|
from yc_value
|
||
|
|
<where>
|
||
|
|
<if test="beginTime != null ">
|
||
|
|
and day >= #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and day <= #{endTime}
|
||
|
|
</if>
|
||
|
|
<if test="stationId != null">
|
||
|
|
and station_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test="stationIds != null and stationIds.size() !=0">
|
||
|
|
and station_id in
|
||
|
|
<foreach collection="stationIds" item="item" open="(" close=")" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
<if test="typeList !=null and typeList.size() !=0">
|
||
|
|
and type in
|
||
|
|
<foreach collection="typeList" item="item" open="(" close=")" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
order by day
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getHoursCounted" resultType="java.math.BigDecimal">
|
||
|
|
select sum(digital)
|
||
|
|
from yc_value
|
||
|
|
where type in (5,6,7,8)
|
||
|
|
<if test="beginTime != null ">
|
||
|
|
and day >= #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and day <= #{endTime}
|
||
|
|
</if>
|
||
|
|
<if test="stationId != null">
|
||
|
|
and station_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test="groupId != null">
|
||
|
|
and group_id = #{groupId}
|
||
|
|
</if>
|
||
|
|
<if test="deptId != null">
|
||
|
|
and dept_id = #{deptId}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="selectCommandsNum" resultType="java.math.BigDecimal">
|
||
|
|
select sum(digital) as digital
|
||
|
|
from yc_value
|
||
|
|
<where>
|
||
|
|
<if test="beginTime != null ">
|
||
|
|
and day >= #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and day <= #{endTime}
|
||
|
|
</if>
|
||
|
|
<if test="stationId != null">
|
||
|
|
and station_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test="groupId != null">
|
||
|
|
and group_id = #{groupId}
|
||
|
|
</if>
|
||
|
|
<if test="deptId != null">
|
||
|
|
and dept_id = #{deptId}
|
||
|
|
</if>
|
||
|
|
<if test="type !=null">
|
||
|
|
and type = #{type}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||
|
|
delete
|
||
|
|
from yc_value
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</delete>
|
||
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.YcValue"
|
||
|
|
useGeneratedKeys="true">
|
||
|
|
insert into yc_value
|
||
|
|
( id, group_id, dept_id
|
||
|
|
, station_id, create_time, type
|
||
|
|
, digital)
|
||
|
|
values ( #{id,jdbcType=INTEGER}, #{groupId,jdbcType=INTEGER}, #{deptId,jdbcType=INTEGER}
|
||
|
|
, #{stationId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=INTEGER}
|
||
|
|
, #{digital,jdbcType=DECIMAL})
|
||
|
|
</insert>
|
||
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.YcValue"
|
||
|
|
useGeneratedKeys="true">
|
||
|
|
insert into yc_value
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="id != null">id,</if>
|
||
|
|
<if test="groupId != null">group_id,</if>
|
||
|
|
<if test="deptId != null">dept_id,</if>
|
||
|
|
<if test="stationId != null">station_id,</if>
|
||
|
|
<if test="createTime != null">create_time,</if>
|
||
|
|
<if test="type != null">type,</if>
|
||
|
|
<if test="digital != null">digital,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="id != null">#{id,jdbcType=INTEGER},</if>
|
||
|
|
<if test="groupId != null">#{groupId,jdbcType=INTEGER},</if>
|
||
|
|
<if test="deptId != null">#{deptId,jdbcType=INTEGER},</if>
|
||
|
|
<if test="stationId != null">#{stationId,jdbcType=INTEGER},</if>
|
||
|
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
||
|
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
||
|
|
<if test="digital != null">#{digital,jdbcType=DECIMAL},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.ho.business.entity.YcValue">
|
||
|
|
update yc_value
|
||
|
|
<set>
|
||
|
|
<if test="groupId != null">
|
||
|
|
group_id = #{groupId,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="deptId != null">
|
||
|
|
dept_id = #{deptId,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="stationId != null">
|
||
|
|
station_id = #{stationId,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
<if test="type != null">
|
||
|
|
type = #{type,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="digital != null">
|
||
|
|
digital = #{digital,jdbcType=DECIMAL},
|
||
|
|
</if>
|
||
|
|
</set>
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</update>
|
||
|
|
<update id="updateByPrimaryKey" parameterType="com.ho.business.entity.YcValue">
|
||
|
|
update yc_value
|
||
|
|
set group_id = #{groupId,jdbcType=INTEGER},
|
||
|
|
dept_id = #{deptId,jdbcType=INTEGER},
|
||
|
|
station_id = #{stationId,jdbcType=INTEGER},
|
||
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||
|
|
type = #{type,jdbcType=INTEGER},
|
||
|
|
digital = #{digital,jdbcType=DECIMAL}
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</update>
|
||
|
|
</mapper>
|