<?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.gk.firework.Mapper.WarnContentInfoMapper" >
|
<resultMap id="BaseResultMap" type="com.gk.firework.Domain.WarnContentInfo" >
|
<!-- -->
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="warntype" property="warntype" jdbcType="VARCHAR" />
|
<result column="warnlevel" property="warnlevel" jdbcType="VARCHAR" />
|
<result column="warncontent" property="warncontent" jdbcType="VARCHAR" />
|
<result column="customid" property="customid" jdbcType="BIGINT" />
|
<result column="enterpriseid" property="enterpriseid" jdbcType="BIGINT" />
|
<result column="ismend" property="ismend" jdbcType="TINYINT" />
|
<result column="isneed" property="isneed" jdbcType="TINYINT" />
|
<result column="issend" property="issend" jdbcType="TINYINT" />
|
<result column="modifiedby" property="modifiedby" jdbcType="VARCHAR" />
|
<result column="modifieddate" property="modifieddate" jdbcType="TIMESTAMP" />
|
<result column="createddate" property="createddate" jdbcType="TIMESTAMP" />
|
<result column="period" property="period" jdbcType="INTEGER" />
|
</resultMap>
|
<sql id="Base_Column_List" >
|
id, warntype, warnlevel, warncontent, customid, enterpriseid, ismend, isneed, issend, modifiedby, modifieddate,createddate, period
|
</sql>
|
<insert id="insertBatch">
|
insert into
|
warncontent
|
<trim prefix="(" suffix=") values" suffixOverrides=",">
|
warntype,
|
warnlevel,
|
warncontent,
|
customid,
|
enterpriseid,
|
ismend,
|
isneed,
|
issend,
|
modifiedby,
|
modifieddate,
|
createddate,
|
period,
|
</trim>
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
#{item.warntype},
|
#{item.warnlevel},
|
#{item.warncontent},
|
#{item.customid},
|
#{item.ismend},
|
#{item.isneed},
|
#{item.issend},
|
#{item.modifiedby},
|
#{item.modifieddate},
|
#{item.createddate},
|
#{item.period},
|
</trim>
|
</foreach>
|
|
|
</insert>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
select
|
<include refid="Base_Column_List" />
|
from warncontent
|
where id = #{id,jdbcType=BIGINT}
|
</select>
|
<select id="selectStockDataGrid" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
|
SELECT
|
warncontent.*,
|
enterprise.safetysupervision as enterprisetype,
|
enterprise.enterprisename,
|
enterprise.enterprisenumber,
|
enterprise.officeaddress
|
from warncontent
|
LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
|
<where>
|
1=1
|
<if test="condition.warntype != null and condition.warntype !=''">
|
and warncontent.warntype = #{condition.warntype}
|
</if>
|
<if test="condition.ismend != null">
|
and warncontent.ismend = #{ismend}
|
</if>
|
<if test="condition.starttime != null and condition.starttime !=''">
|
and warncontent.modifieddate >= #{condition.starttime}
|
</if>
|
<if test="condition.endtime != null and condition.endtime !=''">
|
and warncontent.modifieddate <= #{condition.endtime}
|
</if>
|
<if test="condition.warnlevel != null and condition.warnlevel !=''">
|
and warncontent.warnlevel = #{condition.warnlevel}
|
</if>
|
<if test="condition.enterprisename != null and condition.enterprisename !=''">
|
and enterprise.enterprisename LIKE CONCAT('%',#{condition.enterprisename},'%')
|
</if>
|
<if test="condition.enterprisetype != null and condition.enterprisetype !=''">
|
and enterprise.safetysupervision = #{condition.enterprisetype}
|
</if>
|
<if test="condition.province != null and condition.province !=''">
|
and enterprise.province = #{condition.province}
|
</if>
|
<if test="condition.city != null and condition.city !=''">
|
and enterprise.city = #{condition.city}
|
</if>
|
<if test="condition.area != null and condition.area !=''">
|
and enterprise.district = #{condition.area}
|
</if>
|
<if test="condition.town != null and condition.town !=''">
|
and enterprise.street = #{condition.town}
|
</if>
|
<if test="condition.community != null and condition.community !=''">
|
and enterprise.committee = #{condition.community}
|
</if>
|
</where>
|
</select>
|
<select id="selectPurchaseDataGrid" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
|
SELECT
|
warncontent.*,
|
customer.idcardnum as idcard,
|
customer.`name` as purchasename,
|
customer.address as purchaseaddress
|
from warncontent
|
LEFT JOIN customer AS customer ON customer.id = warncontent.customid
|
<where>
|
1=1
|
<if test="condition.warntype != null and condition.warntype !=''">
|
and warncontent.warntype = #{condition.warntype}
|
</if>
|
<if test="condition.ismend != null">
|
and warncontent.ismend = #{ismend}
|
</if>
|
<if test="condition.starttime != null and condition.starttime !=''">
|
and warncontent.modifieddate >= #{condition.starttime}
|
</if>
|
<if test="condition.endtime != null and condition.endtime !=''">
|
and warncontent.modifieddate <= #{condition.endtime}
|
</if>
|
<if test="condition.warnlevel != null and condition.warnlevel !=''">
|
and warncontent.warnlevel = #{condition.warnlevel}
|
</if>
|
<if test="condition.customer != null and condition.customer !=''">
|
and customer.`name` = #{condition.customer}
|
</if>
|
<if test="condition.idcard != null and condition.idcard !=''">
|
and customer.idcardnum = #{condition.idcard}
|
</if>
|
</where>
|
</select>
|
<select id="selectByWarn" resultType="com.gk.firework.Domain.WarnContentInfo">
|
SELECT
|
<include refid="Base_Column_List" />
|
from warncontent
|
<where>
|
1=1
|
<if test="warntype != null and warntype !=''">
|
and warntype = #{warntype}
|
</if>
|
<if test="warnlevel != null and warnlevel !=''">
|
and warnlevel = #{warnlevel}
|
</if>
|
<if test="customer != null">
|
and customid = #{customer}
|
</if>
|
<if test="warncontent != null and warncontent !=''">
|
and warncontent = #{warncontent}
|
</if>
|
</where>
|
limit 1
|
</select>
|
<select id="selectByEnterpriseWarn" resultType="com.gk.firework.Domain.WarnContentInfo">
|
SELECT
|
<include refid="Base_Column_List" />
|
from warncontent
|
<where>
|
1=1
|
<if test="warntype != null and warntype !=''">
|
and warntype = #{warntype}
|
</if>
|
<if test="warnlevel != null and warnlevel !=''">
|
and warnlevel = #{warnlevel}
|
</if>
|
<if test="enterpriseid != null">
|
and enterpriseid = #{enterpriseid}
|
</if>
|
<if test="warncontent != null and warncontent !=''">
|
and warncontent = #{warncontent}
|
</if>
|
</where>
|
limit 1
|
</select>
|
<select id="selectNeedMail" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
|
select
|
warncontent.*,
|
enterprise.enterprisename,
|
customer.`name` as purchasename,
|
customer.`name` as purchasename,
|
customer.idcardnum as idcard
|
from warncontent
|
LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
|
LEFT JOIN customer AS customer ON customer.id = warncontent.customid
|
where
|
warncontent.isneed = 1
|
AND warncontent.issend = 0
|
AND warncontent.createddate >= #{starttime}
|
AND warncontent.createddate <= #{endtime}
|
</select>
|
<select id="selectIsNotMend" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
|
select
|
warncontent.*,
|
enterprise.enterprisename,
|
enterprise.officeaddress,
|
customer.`name` as purchasename,
|
customer.`name` as purchasename,
|
customer.idcardnum as idcard,
|
customer.address as purchaseaddress
|
from warncontent
|
LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
|
LEFT JOIN customer AS customer ON customer.id = warncontent.customid
|
where
|
warncontent.ismend = 0
|
and warncontent.warnlevel = '报警'
|
order by warncontent.createddate DESC
|
</select>
|
<select id="selectWarningDataGrid" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
|
SELECT
|
warncontent.*,
|
enterprise.safetysupervision as enterprisetype,
|
enterprise.enterprisename,
|
enterprise.enterprisenumber,
|
enterprise.officeaddress,
|
customer.idcardnum as idcard,
|
customer.`name` as purchasename,
|
customer.address as purchaseaddress
|
from warncontent
|
LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
|
LEFT JOIN customer AS customer ON customer.id = warncontent.customid
|
<where>
|
1=1
|
<if test="condition.warntype != null and condition.warntype !=''">
|
and warncontent.warntype = #{condition.warntype}
|
</if>
|
<if test="condition.ismend != null">
|
and warncontent.ismend = #{ismend}
|
</if>
|
<if test="condition.starttime != null and condition.starttime !=''">
|
and warncontent.modifieddate >= #{condition.starttime}
|
</if>
|
<if test="condition.endtime != null and condition.endtime !=''">
|
and warncontent.modifieddate <= #{condition.endtime}
|
</if>
|
<if test="condition.warnlevel != null and condition.warnlevel !=''">
|
and warncontent.warnlevel = #{condition.warnlevel}
|
</if>
|
<if test="condition.customer != null and condition.customer !=''">
|
and customer.`name` = #{condition.customer}
|
</if>
|
<if test="condition.idcard != null and condition.idcard !=''">
|
and customer.idcardnum = #{condition.idcard}
|
</if>
|
<if test="condition.enterprisename != null and condition.enterprisename !=''">
|
and enterprise.enterprisename LIKE CONCAT('%',#{condition.enterprisename},'%')
|
</if>
|
<if test="condition.enterprisetype != null and condition.enterprisetype !=''">
|
and enterprise.safetysupervision = #{condition.enterprisetype}
|
</if>
|
</where>
|
</select>
|
</mapper>
|