<?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="cn.timer.api.dao.spmk.SpmkApproveDetailDraftsMapper"> <!-- 可根据自己的需求,是否要使用 --> <resultMap type="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" id="spmkApproveDetailDraftsMap"> <result property="id" column="id"/> <result property="approveSummaryId" column="approve_summary_id"/> <result property="name" column="name"/> <result property="departmentName" column="department_name"/> <result property="requestData" column="request_data"/> <result property="froms" column="froms"/> <result property="router" column="router"/> <result property="flowChildren" column="flow_children"/> </resultMap> <select id="queryObject" resultType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts"> select * from spmk_approve_detail_drafts where id = #{value} </select> <select id="queryList" resultType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts"> select * from spmk_approve_detail_drafts <where> <if test="approveSummaryId != null and approveSummaryId != ''">AND `approve_summary_id` = #{approveSummaryId} </if> <if test="name != null and name != ''">AND `name` = #{name}</if> <if test="departmentName != null and departmentName != ''">AND `department_name` = #{departmentName}</if> <if test="requestData != null and requestData != ''">AND `request_data` = #{requestData}</if> <if test="froms != null and froms != ''">AND `froms` = #{froms}</if> <if test="router != null and router != ''">AND `router` = #{router}</if> <if test="flowChildren != null and flowChildren != ''">AND `flow_children` = #{flowChildren}</if> </where> <choose> <when test="sidx != null and sidx.trim() != ''"> order by ${sidx} ${order} </when> <otherwise> order by id desc </otherwise> </choose> <if test="offset != null and limit != null"> limit #{offset}, #{limit} </if> </select> <select id="queryTotal" resultType="int"> select count(*) from spmk_approve_detail_drafts <where> <if test="approveSummaryId != null and approveSummaryId != ''">AND `approve_summary_id` = #{approveSummaryId} </if> <if test="name != null and name != ''">AND `name` = #{name}</if> <if test="departmentName != null and departmentName != ''">AND `department_name` = #{departmentName}</if> <if test="requestData != null and requestData != ''">AND `request_data` = #{requestData}</if> <if test="froms != null and froms != ''">AND `froms` = #{froms}</if> <if test="router != null and router != ''">AND `router` = #{router}</if> <if test="flowChildren != null and flowChildren != ''">AND `flow_children` = #{flowChildren}</if> </where> </select> <insert id="save" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" useGeneratedKeys="true" keyProperty="id"> insert into spmk_approve_detail_drafts (`approve_summary_id`, `name`, `department_name`, `request_data`, `froms`, `router`, `flow_children`) values (#{approveSummaryId}, #{name}, #{departmentName}, #{requestData}, #{froms}, #{router}, #{flowChildren}) </insert> <insert id="saveSelective" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" useGeneratedKeys="true" keyProperty="id"> insert into spmk_approve_detail_drafts ( <if test="approveSummaryId != null">,`approve_summary_id`</if> <if test="name != null">,`name`</if> <if test="departmentName != null">,`department_name`</if> <if test="requestData != null">,`request_data`</if> <if test="froms != null">,`froms`</if> <if test="router != null">,`router`</if> <if test="flowChildren != null">,`flow_children`</if> ) values ( <if test="approveSummaryId != null">,#{approveSummaryId}</if> <if test="name != null">,#{name}</if> <if test="departmentName != null">,#{departmentName}</if> <if test="requestData != null">,#{requestData}</if> <if test="froms != null">,#{froms}</if> <if test="router != null">,#{router}</if> <if test="flowChildren != null">,#{flowChildren}</if> ) </insert> <insert id="saveList" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" useGeneratedKeys="true" keyProperty="id"> insert into spmk_approve_detail_drafts ( `approve_summary_id`, `name`, `department_name`, `request_data`, `froms`, `router`, `flow_children` ) values <foreach collection="list" item="item" index="index" separator=","> ( #{item.approveSummaryId}, #{item.name}, #{item.departmentName}, #{item.requestData}, #{item.froms}, #{item.router}, #{item.flowChildren} ) </foreach> </insert> <update id="update" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts"> update spmk_approve_detail_drafts <set> <if test="approveSummaryId != null">`approve_summary_id` = #{approveSummaryId},</if> <if test="name != null">`name` = #{name},</if> <if test="departmentName != null">`department_name` = #{departmentName},</if> <if test="requestData != null">`request_data` = #{requestData},</if> <if test="froms != null">`froms` = #{froms},</if> <if test="router != null">`router` = #{router},</if> <if test="flowChildren != null">`flow_children` = #{flowChildren}</if> </set> where id = #{id} </update> <delete id="delete"> delete from spmk_approve_detail_drafts where id = #{value} </delete> <delete id="deleteBatch"> delete from spmk_approve_detail_drafts where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>