<?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.zc.business.mapper.DcWarningMapper"> <resultMap type="DcWarning" id="DcWarningResult"> <result property="id" column="id" /> <result property="stakeMark" column="stake_mark" /> <result property="direction" column="direction" /> <result property="deptId" column="dept_id" /> <result property="warningState" column="warning_state" /> <result property="warningTime" column="warning_time" /> <result property="userId" column="user_id" /> <result property="warningSource" column="warning_source" /> <result property="warningLevel" column="warning_level" /> <result property="remark" column="remark" /> <result property="createTime" column="create_time" /> <result property="updateTime" column="update_time" /> <result property="warningType" column="warning_type" /> <result property="warningSubclass" column="warning_subclass" /> <result property="warningTitle" column="warning_title" /> <result property="otherConfig" column="other_config" /> <result property="lane" column="lane" /> </resultMap> <sql id="selectDcWarningVo"> select id, stake_mark stakeMark, direction, dept_id deptId, warning_state warningState, DATE_FORMAT(warning_time,'%Y-%m-%d %H:%m:%s')warningTime, user_id userId, warning_source warningSource, warning_level warningLevel, remark, DATE_FORMAT(create_time,'%Y-%m-%d %H:%m:%s')createTime, DATE_FORMAT(update_time,'%Y-%m-%d %H:%m:%s')updateTime, warning_type warningType, warning_subclass warningSubclass, warning_title warningTitle, other_config otherConfig, lane from dc_warning </sql> <select id="selectDcWarningList" parameterType="DcWarning" resultType="hashmap"> <include refid="selectDcWarningVo"/> <where> <if test="stakeMark != null and stakeMark != ''"> and stake_mark = #{stakeMark}</if> <if test="direction != null and direction != ''"> and direction = #{direction}</if> <if test="deptId != null "> and dept_id = #{deptId}</if> <if test="warningState != null "> and warning_state = #{warningState}</if> <if test="warningTime != null "> and warning_time = #{warningTime}</if> <if test="userId != null "> and user_id = #{userId}</if> <if test="warningSource != null "> and warning_source = #{warningSource}</if> <if test="warningLevel != null "> and warning_level = #{warningLevel}</if> <if test="warningType != null "> and warning_type = #{warningType}</if> <if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if> <if test="warningTitle != null and warningTitle != ''"> and warning_title = #{warningTitle}</if> <if test="otherConfig != null and otherConfig != ''"> and other_config = #{otherConfig}</if> <if test="lane != null and lane != ''"> and lane = #{lane}</if> </where> </select> <select id="selectDcWarningById" parameterType="Integer" resultType="hashmap"> <include refid="selectDcWarningVo"/> where id = #{id} </select> <select id="export" resultType="com.zc.business.domain.DcWarning"> SELECT warning.`id`,warning.`stake_mark`, warning.`direction`, mark.longitude,mark.latitude,warning.lane, warning.`dept_id`,warning.`warning_state`,warning.`warning_time`, warning.`user_id`, warning.`warning_source`,warning.`warning_level`, warning.`remark`, warning.`create_time`,warning.`update_time`, warning.`warning_type`,warning.`warning_subclass`,warning.`warning_title`, warning.`other_config` FROM dc_warning AS warning LEFT JOIN dc_stake_mark AS mark ON mark.stake_mark=warning.stake_mark </select> <insert id="insertDcWarning" parameterType="DcWarning" useGeneratedKeys="true" keyProperty="id"> insert into dc_warning <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="stakeMark != null and stakeMark != ''">stake_mark,</if> <if test="direction != null">direction,</if> <if test="deptId != null">dept_id,</if> <if test="warningState != null">warning_state,</if> <if test="warningTime != null">warning_time,</if> <if test="userId != null">user_id,</if> <if test="warningSource != null">warning_source,</if> <if test="warningLevel != null">warning_level,</if> <if test="remark != null">remark,</if> <if test="createTime != null">create_time,</if> <if test="updateTime != null">update_time,</if> <if test="warningType != null">warning_type,</if> <if test="warningSubclass != null">warning_subclass,</if> <if test="warningTitle != null">warning_title,</if> <if test="otherConfig != null">other_config,</if> <if test="lane != null">lane,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> <if test="stakeMark != null and stakeMark != ''">#{stakeMark},</if> <if test="direction != null">#{direction},</if> <if test="deptId != null">#{deptId},</if> <if test="warningState != null">#{warningState},</if> <if test="warningTime != null">#{warningTime},</if> <if test="userId != null">#{userId},</if> <if test="warningSource != null">#{warningSource},</if> <if test="warningLevel != null">#{warningLevel},</if> <if test="remark != null">#{remark},</if> <if test="createTime != null">#{createTime},</if> <if test="updateTime != null">#{updateTime},</if> <if test="warningType != null">#{warningType},</if> <if test="warningSubclass != null">#{warningSubclass},</if> <if test="warningTitle != null">#{warningTitle},</if> <if test="otherConfig != null">#{otherConfig},</if> <if test="lane != null">#{lane},</if> </trim> </insert> <update id="updateDcWarning" parameterType="DcWarning"> update dc_warning <trim prefix="SET" suffixOverrides=","> <if test="stakeMark != null and stakeMark != ''">stake_mark = #{stakeMark},</if> <if test="direction != null">direction = #{direction},</if> <if test="deptId != null">dept_id = #{deptId},</if> <if test="warningState != null">warning_state = #{warningState},</if> <if test="warningTime != null">warning_time = #{warningTime},</if> <if test="userId != null">user_id = #{userId},</if> <if test="warningSource != null">warning_source = #{warningSource},</if> <if test="warningLevel != null">warning_level = #{warningLevel},</if> <if test="remark != null">remark = #{remark},</if> <if test="createTime != null">create_time = #{createTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if> <if test="warningType != null">warning_type = #{warningType},</if> <if test="warningSubclass != null">warning_subclass = #{warningSubclass},</if> <if test="warningTitle != null">warning_title = #{warningTitle},</if> <if test="otherConfig != null">other_config = #{otherConfig},</if> <if test="lane != null">lane = #{lane},</if> </trim> where id = #{id} </update> <delete id="deleteDcWarningById" parameterType="Integer"> delete from dc_warning where id = #{id} </delete> <delete id="deleteDcWarningByIds" parameterType="String"> delete from dc_warning where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> <select id="selectCount" resultType="int"> SELECT COUNT(*)AS count FROM dc_warning </select> </mapper>