<?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.ycl.platform.mapper.YwUnitMapper">
|
|
<resultMap type="YwUnitVo" id="YwUnitResult">
|
<result property="id" column="id" />
|
<result property="unitCode" column="unit_code" />
|
<result property="unitName" column="unit_name" />
|
<result property="unitContact" column="unit_contact" />
|
<result property="unitContactPhone" column="unit_contact_phone" />
|
<result property="unitAdminAccount" column="unit_admin_account" />
|
<result property="remark" column="remark" />
|
<result property="createTime" column="create_time" />
|
</resultMap>
|
|
<sql id="selectYwUnitVo">
|
select id, unit_code, unit_name, unit_contact, unit_contact_phone, unit_admin_account, remark, create_time, update_time, deleted from t_yw_unit
|
</sql>
|
|
<select id="selectYwUnitList" parameterType="YwUnit" resultMap="YwUnitResult">
|
<include refid="selectYwUnitVo"/>
|
<where>
|
<if test="unitCode != null and unitCode != ''"> and unit_code = #{unitCode}</if>
|
<if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
</where>
|
</select>
|
|
<select id="selectYwUnitById" parameterType="Long" resultMap="YwUnitResult">
|
<include refid="selectYwUnitVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertYwUnit" parameterType="YwUnit" useGeneratedKeys="true" keyProperty="id">
|
insert into t_yw_unit
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="unitCode != null and unitCode != ''">unit_code,</if>
|
<if test="unitName != null and unitName != ''">unit_name,</if>
|
<if test="unitContact != null and unitContact != ''">unit_contact,</if>
|
<if test="unitContactPhone != null and unitContactPhone != ''">unit_contact_phone,</if>
|
<if test="unitAdminAccount != null and unitAdminAccount != ''">unit_admin_account,</if>
|
<if test="remark != null">remark,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
<if test="deleted != null">deleted,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="unitCode != null and unitCode != ''">#{unitCode},</if>
|
<if test="unitName != null and unitName != ''">#{unitName},</if>
|
<if test="unitContact != null and unitContact != ''">#{unitContact},</if>
|
<if test="unitContactPhone != null and unitContactPhone != ''">#{unitContactPhone},</if>
|
<if test="unitAdminAccount != null and unitAdminAccount != ''">#{unitAdminAccount},</if>
|
<if test="remark != null">#{remark},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="deleted != null">#{deleted},</if>
|
</trim>
|
</insert>
|
|
<update id="updateYwUnit" parameterType="YwUnit">
|
update t_yw_unit
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="unitCode != null and unitCode != ''">unit_code = #{unitCode},</if>
|
<if test="unitName != null and unitName != ''">unit_name = #{unitName},</if>
|
<if test="unitContact != null and unitContact != ''">unit_contact = #{unitContact},</if>
|
<if test="unitContactPhone != null and unitContactPhone != ''">unit_contact_phone = #{unitContactPhone},</if>
|
<if test="unitAdminAccount != null and unitAdminAccount != ''">unit_admin_account = #{unitAdminAccount},</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="deleted != null">deleted = #{deleted},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteYwUnitById" parameterType="Long">
|
delete from t_yw_unit where id = #{id}
|
</delete>
|
|
<delete id="deleteYwUnitByIds" parameterType="String">
|
delete from t_yw_unit where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|