97 lines
4.5 KiB
XML
97 lines
4.5 KiB
XML
<?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.xzzn.ems.mapper.EmsStrategyMapper">
|
|
|
|
<resultMap type="EmsStrategy" id="EmsStrategyResult">
|
|
<result property="id" column="id" />
|
|
<result property="strategyName" column="strategy_name" />
|
|
<result property="strategyType" column="strategy_type" />
|
|
<result property="status" column="status" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="description" column="description" />
|
|
<result property="mainStrategy" column="main_strategy" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEmsStrategyVo">
|
|
select id, strategy_name, strategy_type, status, create_time, update_time, description, main_strategy from ems_strategy
|
|
</sql>
|
|
|
|
<select id="selectEmsStrategyList" parameterType="EmsStrategy" resultMap="EmsStrategyResult">
|
|
<include refid="selectEmsStrategyVo"/>
|
|
<where>
|
|
<if test="strategyName != null and strategyName != ''"> and strategy_name like concat('%', #{strategyName}, '%')</if>
|
|
<if test="strategyType != null "> and strategy_type = #{strategyType}</if>
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
<if test="mainStrategy != null "> and main_strategy = #{mainStrategy}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectEmsStrategyById" parameterType="Long" resultMap="EmsStrategyResult">
|
|
<include refid="selectEmsStrategyVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmsStrategy" parameterType="EmsStrategy" useGeneratedKeys="true" keyProperty="id">
|
|
insert into ems_strategy
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="strategyName != null">strategy_name,</if>
|
|
<if test="strategyType != null">strategy_type,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="description != null">description,</if>
|
|
<if test="mainStrategy != null">main_strategy,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="strategyName != null">#{strategyName},</if>
|
|
<if test="strategyType != null">#{strategyType},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="description != null">#{description},</if>
|
|
<if test="mainStrategy != null">#{mainStrategy},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmsStrategy" parameterType="EmsStrategy">
|
|
update ems_strategy
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="strategyName != null">strategy_name = #{strategyName},</if>
|
|
<if test="strategyType != null">strategy_type = #{strategyType},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="description != null">description = #{description},</if>
|
|
<if test="mainStrategy != null">main_strategy = #{mainStrategy},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteEmsStrategyById" parameterType="Long">
|
|
delete from ems_strategy where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmsStrategyByIds" parameterType="String">
|
|
delete from ems_strategy where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="getStrategyListByType" resultMap="EmsStrategyResult">
|
|
<include refid="selectEmsStrategyVo"/>
|
|
where 1=1
|
|
<if test="strategyType != null">
|
|
and strategy_type = #{type}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getStrategyByName" parameterType="String" resultMap="EmsStrategyResult">
|
|
<include refid="selectEmsStrategyVo"/>
|
|
where strategy_name = #{strategyName}
|
|
</select>
|
|
</mapper> |