Bonus-Cloud-Material/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTeamInfoMapper.xml

80 lines
3.8 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.lease.mapper.LeaseTeamInfoMapper">
<resultMap type="com.bonus.material.lease.domain.LeaseTeamInfo" id="LeaseTeamInfoResult">
<result property="id" column="id" />
<result property="teamName" column="team_name" />
<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" />
<result property="companyId" column="company_id" />
</resultMap>
<sql id="selectLeaseTeamInfoVo">
select id, team_name, create_by, create_time, update_by, update_time, remark, company_id from lease_team_info
</sql>
<select id="selectLeaseTeamInfoList" parameterType="com.bonus.material.lease.domain.LeaseTeamInfo" resultMap="LeaseTeamInfoResult">
<include refid="selectLeaseTeamInfoVo"/>
<where>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="companyId != null "> and company_id = #{companyId}</if>
</where>
</select>
<select id="selectLeaseTeamInfoById" parameterType="Long" resultMap="LeaseTeamInfoResult">
<include refid="selectLeaseTeamInfoVo"/>
where id = #{id}
</select>
<insert id="insertLeaseTeamInfo" parameterType="com.bonus.material.lease.domain.LeaseTeamInfo" useGeneratedKeys="true" keyProperty="id">
insert into lease_team_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="teamName != null">team_name,</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>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teamName != null">#{teamName},</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>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<update id="updateLeaseTeamInfo" parameterType="com.bonus.material.lease.domain.LeaseTeamInfo">
update lease_team_info
<trim prefix="SET" suffixOverrides=",">
<if test="teamName != null">team_name = #{teamName},</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>
<if test="companyId != null">company_id = #{companyId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLeaseTeamInfoById" parameterType="Long">
delete from lease_team_info where id = #{id}
</delete>
<delete id="deleteLeaseTeamInfoByIds" parameterType="String">
delete from lease_team_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>