104 lines
5.3 KiB
XML
104 lines
5.3 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.bonus.material.basic.mapper.BmUnitMapper">
|
||
|
|
<resultMap type="com.bonus.material.basic.domain.BmUnit" id="BmUnitResult">
|
||
|
|
<result property="unitId" column="unit_id" />
|
||
|
|
<result property="unitName" column="unit_name" />
|
||
|
|
<result property="status" column="status" />
|
||
|
|
<result property="typeId" column="type_id" />
|
||
|
|
<result property="linkMan" column="link_man" />
|
||
|
|
<result property="telphone" column="telphone" />
|
||
|
|
<result property="deptId" column="dept_id" />
|
||
|
|
<result property="delFlag" column="del_flag" />
|
||
|
|
<result property="createBy" column="create_by" />
|
||
|
|
<result property="createTime" column="create_time" />
|
||
|
|
<result property="updateBy" column="update_by" />
|
||
|
|
<result property="updateTime" column="update_time" />
|
||
|
|
<result property="remark" column="remark" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectBmUnitVo">
|
||
|
|
select unit_id, unit_name, status, type_id, link_man, telphone, dept_id, del_flag, create_by, create_time, update_by, update_time, remark from bm_unit
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectBmUnitList" parameterType="com.bonus.material.basic.domain.BmUnit" resultMap="BmUnitResult">
|
||
|
|
<include refid="selectBmUnitVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
|
||
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||
|
|
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||
|
|
<if test="linkMan != null and linkMan != ''"> and link_man = #{linkMan}</if>
|
||
|
|
<if test="telphone != null and telphone != ''"> and telphone = #{telphone}</if>
|
||
|
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectBmUnitByUnitId" parameterType="Long" resultMap="BmUnitResult">
|
||
|
|
<include refid="selectBmUnitVo"/>
|
||
|
|
where unit_id = #{unitId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertBmUnit" parameterType="com.bonus.material.basic.domain.BmUnit" useGeneratedKeys="true" keyProperty="unitId">
|
||
|
|
insert into bm_unit
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="unitName != null and unitName != ''">unit_name,</if>
|
||
|
|
<if test="status != null">status,</if>
|
||
|
|
<if test="typeId != null">type_id,</if>
|
||
|
|
<if test="linkMan != null">link_man,</if>
|
||
|
|
<if test="telphone != null">telphone,</if>
|
||
|
|
<if test="deptId != null">dept_id,</if>
|
||
|
|
<if test="delFlag != null">del_flag,</if>
|
||
|
|
<if test="createBy != null">create_by,</if>
|
||
|
|
<if test="createTime != null">create_time,</if>
|
||
|
|
<if test="updateBy != null">update_by,</if>
|
||
|
|
<if test="updateTime != null">update_time,</if>
|
||
|
|
<if test="remark != null">remark,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="unitName != null and unitName != ''">#{unitName},</if>
|
||
|
|
<if test="status != null">#{status},</if>
|
||
|
|
<if test="typeId != null">#{typeId},</if>
|
||
|
|
<if test="linkMan != null">#{linkMan},</if>
|
||
|
|
<if test="telphone != null">#{telphone},</if>
|
||
|
|
<if test="deptId != null">#{deptId},</if>
|
||
|
|
<if test="delFlag != null">#{delFlag},</if>
|
||
|
|
<if test="createBy != null">#{createBy},</if>
|
||
|
|
<if test="createTime != null">#{createTime},</if>
|
||
|
|
<if test="updateBy != null">#{updateBy},</if>
|
||
|
|
<if test="updateTime != null">#{updateTime},</if>
|
||
|
|
<if test="remark != null">#{remark},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateBmUnit" parameterType="com.bonus.material.basic.domain.BmUnit">
|
||
|
|
update bm_unit
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="unitName != null and unitName != ''">unit_name = #{unitName},</if>
|
||
|
|
<if test="status != null">status = #{status},</if>
|
||
|
|
<if test="typeId != null">type_id = #{typeId},</if>
|
||
|
|
<if test="linkMan != null">link_man = #{linkMan},</if>
|
||
|
|
<if test="telphone != null">telphone = #{telphone},</if>
|
||
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
||
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
|
<if test="remark != null">remark = #{remark},</if>
|
||
|
|
</trim>
|
||
|
|
where unit_id = #{unitId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteBmUnitByUnitId" parameterType="Long">
|
||
|
|
delete from bm_unit where unit_id = #{unitId}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteBmUnitByUnitIds" parameterType="String">
|
||
|
|
delete from bm_unit where unit_id in
|
||
|
|
<foreach item="unitId" collection="array" open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|