123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?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.zhyc.xps.goaf.mapper.GoafDevInfoMapper">
- <resultMap id="GoafDevInfoMapper" type="com.zhyc.xps.goaf.entity.GoafDevInfo">
- <id column="goaf_dev_id" property="goafDevId" jdbcType="BIGINT"/>
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
- <result column="goaf_dev_name" property="goafDevName" jdbcType="VARCHAR"/>
- <result column="goaf_dev_location" property="goafDevLocation" jdbcType="VARCHAR"/>
- <result column="goaf_dev_typename" property="goafDevTypename" jdbcType="VARCHAR"/>
- <result column="goaf_install_time" property="goafInstallTime" jdbcType="TIMESTAMP"/>
- </resultMap>
- <resultMap id="GoafDevInfoDtoMapper" type="com.zhyc.xps.goaf.dto.GoafDevInfoDto">
- <id column="goaf_dev_id" property="goafDevId" jdbcType="BIGINT"/>
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
- <result column="goaf_dev_name" property="goafDevName" jdbcType="VARCHAR"/>
- <result column="goaf_dev_location" property="goafDevLocation" jdbcType="VARCHAR"/>
- <result column="goaf_dev_typename" property="goafDevTypename" jdbcType="VARCHAR"/>
- <result column="goaf_install_time" property="goafInstallTime" jdbcType="TIMESTAMP"/>
- </resultMap>
- <select id="getByList" parameterType="java.util.Map" resultMap="GoafDevInfoMapper">
- SELECT *
- FROM goaf_devinfo
- <trim prefix="where" prefixOverrides="AND">
- <if test="ocId !=null">
- oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="goafDevName !=null and goafDevName != ''">
- AND goaf_dev_name = #{goafDevName ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevLocation !=null and goafDevLocation != ''">
- AND goaf_dev_location = #{goafDevLocation ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevTypename !=null and goafDevTypename != ''">
- AND goaf_dev_typename = #{goafDevTypename ,jdbcType=VARCHAR}
- </if>
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND goaf_install_time BETWEEN #{startDate} AND #{endDate}
- </if>
- </trim>
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="GoafDevInfoMapper">
- SELECT *
- FROM goaf_devinfo
- <trim prefix="where" prefixOverrides="AND">
- <if test="ocId !=null">
- oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="goafDevName !=null and goafDevName != ''">
- AND goaf_dev_name = #{goafDevName ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevLocation !=null and goafDevLocation != ''">
- AND goaf_dev_location = #{goafDevLocation ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevTypename !=null and goafDevTypename != ''">
- AND goaf_dev_typename = #{goafDevTypename ,jdbcType=VARCHAR}
- </if>
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND goaf_install_time BETWEEN #{startDate} AND #{endDate}
- </if>
- </trim>
- </select>
- <select id="getByGoafDevId" resultMap="GoafDevInfoMapper">
- SELECT *
- FROM goaf_devinfo
- WHERE goaf_dev_id = #{goafDevId, jdbcType=BIGINT}
- </select>
- <select id="getByGoafDevName" resultMap="GoafDevInfoMapper">
- SELECT *
- FROM goaf_devinfo
- WHERE goaf_dev_name = #{goafDevName, jdbcType=VARCHAR}
- </select>
- <insert id="create" parameterType="com.zhyc.xps.goaf.entity.GoafDevInfo">
- insert into goaf_devinfo
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="goafDevId != null">
- goaf_dev_id,
- </if>
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="goafDevName != null and goafDevName != ''">
- goaf_dev_name,
- </if>
- <if test="goafDevLocation != null and goafDevLocation != ''">
- goaf_dev_location,
- </if>
- <if test="goafDevTypename != null and goafDevTypename != ''">
- goaf_dev_typename,
- </if>
- <if test="goafInstallTime != null">
- goaf_install_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="goafDevId != null">
- #{goafDevId, jdbcType=BIGINT},
- </if>
- <if test="ocId != null">
- #{ocId, jdbcType=BIGINT},
- </if>
- <if test="goafDevName != null and goafDevName != ''">
- #{goafDevName, jdbcType=VARCHAR},
- </if>
- <if test="goafDevLocation != null and goafDevLocation != ''">
- #{goafDevLocation, jdbcType=VARCHAR},
- </if>
- <if test="goafDevTypename != null and goafDevTypename != ''">
- #{goafDevTypename, jdbcType=VARCHAR},
- </if>
- <if test="goafInstallTime != null">
- #{goafInstallTime, jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--Update更新-->
- <update id="update" parameterType="com.zhyc.xps.goaf.entity.GoafDevInfo">
- UPDATE goaf_devinfo
- <trim suffixOverrides=",">
- <set>
- <if test="goafDevName != null and goafDevName != ''">
- goaf_dev_name = #{goafDevName, jdbcType=VARCHAR},
- </if>
- <if test="goafDevLocation != null and goafDevLocation != ''">
- goaf_dev_location = #{goafDevLocation, jdbcType=VARCHAR},
- </if>
- <if test="goafDevTypename != null and goafDevTypename != ''">
- goaf_dev_typename = #{goafDevTypename, jdbcType=VARCHAR},
- </if>
- <if test="goafInstallTime != null">
- goaf_install_time = #{goafInstallTime, jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE goaf_dev_id = #{goafDevId, jdbcType=BIGINT}
- </update>
- <delete id="delete" >
- DELETE FROM goaf_devinfo
- WHERE goaf_dev_id = #{goafDevId, jdbcType=BIGINT}
- </delete>
- <!--列表查询-->
- <select id="getStatisNum" parameterType="java.util.Map" resultType="com.zhyc.xps.goaf.vo.DevStatisVo">
- SELECT
- COUNT(*) AS 'goafDevTotalNum',
- IFNULL(SUM( CASE WHEN goaf_dev_typename = '空压机' THEN 1 ELSE 0 END ), 0) AS 'compressorNum',
- IFNULL(SUM( CASE WHEN goaf_dev_typename = '水泵' THEN 1 ELSE 0 END ), 0) AS 'waterpumpNum',
- IFNULL(SUM( CASE WHEN goaf_dev_typename = '电机' THEN 1 ELSE 0 END ), 0) AS 'electricalmachineryNum',
- IFNULL(SUM( CASE WHEN goaf_dev_typename = '其它' THEN 1 ELSE 0 END ), 0) AS 'otherNum'
- FROM goaf_devinfo
- WHERE oc_id = #{ocId ,jdbcType=BIGINT}
- </select>
- </mapper>
|