|
@@ -0,0 +1,100 @@
|
|
|
+<?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.ruoyi.qdtl.mapper.TlPatrolmanMapper">
|
|
|
+
|
|
|
+ <resultMap type="TlPatrolman" id="TlPatrolmanResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <result property="card" column="card"/>
|
|
|
+ <result property="areaId" column="area_id"/>
|
|
|
+ <result property="areaName" column="area_name"/>
|
|
|
+ <result property="thirdId" column="third_id"/>
|
|
|
+ <result property="version" column="version"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectTlPatrolmanVo">
|
|
|
+ select id, name, card, area_id, area_name, third_id, version
|
|
|
+ from tl_patrolman
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectTlPatrolmanList" parameterType="TlPatrolman" resultMap="TlPatrolmanResult">
|
|
|
+ <include refid="selectTlPatrolmanVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
|
+ <if test="card != null and card != ''">and card = #{card}</if>
|
|
|
+ <if test="areaId != null and areaId != ''">and area_id = #{areaId}</if>
|
|
|
+ <if test="areaName != null and areaName != ''">and area_name like concat('%', #{areaName}, '%')</if>
|
|
|
+ <if test="thirdId != null and thirdId != ''">and third_id = #{thirdId}</if>
|
|
|
+ <if test="version != null ">and version = #{version}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTlPatrolmanById" parameterType="Long" resultMap="TlPatrolmanResult">
|
|
|
+ <include refid="selectTlPatrolmanVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryMaxVsersion" resultType="java.lang.Integer">
|
|
|
+ select ifnull(max(version), 0)
|
|
|
+ from tl_patrolman
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryByThirdId" resultMap="TlPatrolmanResult">
|
|
|
+ <include refid="selectTlPatrolmanVo"/>
|
|
|
+ where third_id = #{thirdId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertTlPatrolman" parameterType="TlPatrolman" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into tl_patrolman
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="name != null">name,</if>
|
|
|
+ <if test="card != null">card,</if>
|
|
|
+ <if test="areaId != null">area_id,</if>
|
|
|
+ <if test="areaName != null">area_name,</if>
|
|
|
+ <if test="thirdId != null">third_id,</if>
|
|
|
+ <if test="version != null">version,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="name != null">#{name},</if>
|
|
|
+ <if test="card != null">#{card},</if>
|
|
|
+ <if test="areaId != null">#{areaId},</if>
|
|
|
+ <if test="areaName != null">#{areaName},</if>
|
|
|
+ <if test="thirdId != null">#{thirdId},</if>
|
|
|
+ <if test="version != null">#{version},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateTlPatrolman" parameterType="TlPatrolman">
|
|
|
+ update tl_patrolman
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="name != null">name = #{name},</if>
|
|
|
+ <if test="card != null">card = #{card},</if>
|
|
|
+ <if test="areaId != null">area_id = #{areaId},</if>
|
|
|
+ <if test="areaName != null">area_name = #{areaName},</if>
|
|
|
+ <if test="thirdId != null">third_id = #{thirdId},</if>
|
|
|
+ <if test="version != null">version = #{version},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteTlPatrolmanById" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from tl_patrolman
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTlPatrolmanByIds" parameterType="String">
|
|
|
+ delete from tl_patrolman where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deletePatrolmanByVersion">
|
|
|
+ delete
|
|
|
+ from tl_patrolman
|
|
|
+ where version != #{version}
|
|
|
+ </delete>
|
|
|
+</mapper>
|