Commit 49511a9c authored by duanruiming's avatar duanruiming

[update] 优化持久层

parent c7aeef29
<?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="net.wanji.databus.dao.mapper.BaseCrossPhaseLightsMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.databus.dao.entity.CrossPhaseLightsPO" id="BaseResultMap">
<result property="id" column="id"/>
<result property="lightsId" column="lights_id"/>
<result property="phaseId" column="phase_id"/>
<result property="crossId" column="cross_id"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<sql id="Base_Column_List">
id, lights_id, phase_id, cross_id, gmt_create, gmt_modified
</sql>
<select id="listCrossPhaseLightsPO" resultMap="BaseResultMap" parameterType="net.wanji.databus.dao.entity.CrossPhaseLightsPO">
select
<include refid="Base_Column_List"></include>
from t_base_cross_phase_lights
<where>
<if test="entity.crossId != null and entity.crossId != ''">
and cross_id = #{entity.crossId}
</if>
<if test="entity.phaseId != null and entity.phaseId != ''">
and phase_id = #{entity.phaseId}
</if>
</where>
</select>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into t_base_cross_phase_lights(lights_id,phase_id,cross_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.lightsId},#{entity.phaseId},#{entity.crossId})
</foreach>
</insert>
<insert id="insertOne" keyProperty="id" useGeneratedKeys="true">
insert into t_base_cross_phase_lights(lights_id,phase_id,cross_id)
values (#{lightsId},#{phaseId},#{crossId})
</insert>
<update id="updateLightsId">
update t_base_cross_phase_lights
set lights_id = #{newId}
where lights_id = #{oldId}
</update>
<delete id="deleteByCrossId">
delete from t_base_cross_phase_lights
where cross_id = #{crossId}
</delete>
<select id="selectByPhaseId" resultMap="BaseResultMap">
select
id,lights_id,phase_id,cross_id,gmt_create,gmt_modified
from t_base_cross_phase_lights
where phase_id = #{phaseId}
</select>
<select id="selectByLightsId" resultMap="BaseResultMap">
select
id,lights_id,phase_id,cross_id,gmt_create,gmt_modified
from t_base_cross_phase_lights
where lights_id = #{lightsId}
</select>
<select id="selectIdByThreeIds" resultType="java.lang.Integer">
SELECT id from t_base_cross_phase_lights
WHERE cross_id = #{crossId} and lights_id = #{lightsId} and phase_id = #{phaseId}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment