You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
231 lines
9.4 KiB
231 lines
9.4 KiB
|
3 years ago
|
<?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.zdxt.autoCode.mapper.SysAutoCodeMapper">
|
||
|
|
<resultMap type="com.zdxt.autoCode.entity.SysAutoCode" id="SysAutoCodeMap">
|
||
|
|
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||
|
|
<result property="codeName" column="code_name" />
|
||
|
|
<result property="codeDesc" column="code_desc" />
|
||
|
|
<result property="parentId" column="parent_id" />
|
||
|
|
<result property="orderId" column="order_id" />
|
||
|
|
<result property="creator" column="create_by" />
|
||
|
|
<result property="createTime" column="create_time" />
|
||
|
|
<result property="updator" column="update_by" />
|
||
|
|
<result property="updateTime" column="update_time" />
|
||
|
|
<result property="userId" column="user_id" />
|
||
|
|
<result property="deptId" column="dept_id" />
|
||
|
|
<result property="sassId" column="sass_id" />
|
||
|
|
<result property="extend1" column="extend1" />
|
||
|
|
<result property="extend2" column="extend2" />
|
||
|
|
<result property="codeValue" column="code_value" />
|
||
|
|
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!-- 通过ID查询单条数据 -->
|
||
|
|
<select id="queryById" resultMap="SysAutoCodeMap">
|
||
|
|
select
|
||
|
|
id,code_name,code_desc,parent_id,order_id,create_by,create_time,update_by,update_time,user_id,dept_id,sass_id,extend1,extend2,code_value
|
||
|
|
from sys_auto_code
|
||
|
|
where id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--分页查询指定行数据-->
|
||
|
|
<select id="queryAllByLimit" resultMap="SysAutoCodeMap">
|
||
|
|
select
|
||
|
|
id,code_name,code_desc,parent_id,order_id,create_by,create_time,update_by,update_time,user_id,dept_id,sass_id,extend1,extend2,code_value
|
||
|
|
from sys_auto_code
|
||
|
|
<where>
|
||
|
|
<if test="id != null and id != ''">
|
||
|
|
and id = #{id}
|
||
|
|
</if>
|
||
|
|
<if test="codeName != null and codeName != ''">
|
||
|
|
and code_name = #{codeName}
|
||
|
|
</if>
|
||
|
|
<if test="codeDesc != null and codeDesc != ''">
|
||
|
|
and code_desc = #{codeDesc}
|
||
|
|
</if>
|
||
|
|
<if test="parentId != null and parentId != ''">
|
||
|
|
and parent_id = #{parentId}
|
||
|
|
</if>
|
||
|
|
<if test="orderId != null and orderId != ''">
|
||
|
|
and order_id = #{orderId}
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
and create_by = #{creator}
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null and createTime != ''">
|
||
|
|
and create_time = #{createTime}
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null and updateBy != ''">
|
||
|
|
and update_by = #{updateBy}
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null and updateTime != ''">
|
||
|
|
and update_time = #{updateTime}
|
||
|
|
</if>
|
||
|
|
<if test="userId != null and userId != ''">
|
||
|
|
and user_id = #{userId}
|
||
|
|
</if>
|
||
|
|
<if test="deptId != null and deptId != ''">
|
||
|
|
and dept_id = #{deptId}
|
||
|
|
</if>
|
||
|
|
<if test="sassId != null and sassId != ''">
|
||
|
|
and sass_id = #{sassId}
|
||
|
|
</if>
|
||
|
|
<if test="extend1 != null and extend1 != ''">
|
||
|
|
and extend1 = #{extend1}
|
||
|
|
</if>
|
||
|
|
<if test="extend2 != null and extend2 != ''">
|
||
|
|
and extend2 = #{extend2}
|
||
|
|
</if>
|
||
|
|
<if test="codeValue != null and codeValue != ''">
|
||
|
|
and code_value = #{codeValue}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--统计总行数-->
|
||
|
|
<select id="count" resultType="java.lang.Long">
|
||
|
|
select count(1)
|
||
|
|
from sys_auto_code
|
||
|
|
<where>
|
||
|
|
<if test="id != null and id != ''">
|
||
|
|
and id = #{id}
|
||
|
|
</if>
|
||
|
|
<if test="codeName != null and codeName != ''">
|
||
|
|
and code_name = #{codeName}
|
||
|
|
</if>
|
||
|
|
<if test="codeDesc != null and codeDesc != ''">
|
||
|
|
and code_desc = #{codeDesc}
|
||
|
|
</if>
|
||
|
|
<if test="parentId != null and parentId != ''">
|
||
|
|
and parent_id = #{parentId}
|
||
|
|
</if>
|
||
|
|
<if test="orderId != null and orderId != ''">
|
||
|
|
and order_id = #{orderId}
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
and create_by = #{createBy}
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null and createTime != ''">
|
||
|
|
and create_time = #{createTime}
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null and updateBy != ''">
|
||
|
|
and update_by = #{updateBy}
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null and updateTime != ''">
|
||
|
|
and update_time = #{updateTime}
|
||
|
|
</if>
|
||
|
|
<if test="userId != null and userId != ''">
|
||
|
|
and user_id = #{userId}
|
||
|
|
</if>
|
||
|
|
<if test="deptId != null and deptId != ''">
|
||
|
|
and dept_id = #{deptId}
|
||
|
|
</if>
|
||
|
|
<if test="sassId != null and sassId != ''">
|
||
|
|
and sass_id = #{sassId}
|
||
|
|
</if>
|
||
|
|
<if test="extend1 != null and extend1 != ''">
|
||
|
|
and extend1 = #{extend1}
|
||
|
|
</if>
|
||
|
|
<if test="extend2 != null and extend2 != ''">
|
||
|
|
and extend2 = #{extend2}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--新增数据-->
|
||
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||
|
|
insert into sys_auto_code(id,code_name,code_desc,parent_id,order_id,create_by,create_time,update_by,update_time,user_id,dept_id,sass_id,extend1,extend2,code_value)
|
||
|
|
values (#{id},#{codeName},#{codeDesc},#{parentId},#{orderId},#{creator},sysdate(),#{updator},#{updateTime},#{userId},#{deptId},#{sassId},#{extend1},#{extend2},#{codeValue})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<!-- 批量新增数据 -->
|
||
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||
|
|
insert into sys_auto_code(id,code_name,code_desc,parent_id,order_id,create_by,create_time,update_by,update_time,user_id,dept_id,sass_id,extend1,extend2)
|
||
|
|
values
|
||
|
|
<foreach collection="entities" item="entity" separator=",">
|
||
|
|
(#{entity.id},#{entity.codeName},#{entity.codeDesc},#{entity.parentId},#{entity.orderId},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.userId},#{entity.deptId},#{entity.sassId},#{entity.extend1},#{entity.extend2})
|
||
|
|
</foreach>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<!-- 批量新增或按主键更新数据 -->
|
||
|
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||
|
|
insert into sys_auto_code(id,code_name,code_desc,parent_id,order_id,create_by,create_time,update_by,update_time,user_id,dept_id,sass_id,extend1,extend2)
|
||
|
|
values
|
||
|
|
<foreach collection="entities" item="entity" separator=",">
|
||
|
|
(#{entity.id},#{entity.codeName},#{entity.codeDesc},#{entity.parentId},#{entity.orderId},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.userId},#{entity.deptId},#{entity.sassId},#{entity.extend1},#{entity.extend2})
|
||
|
|
</foreach>
|
||
|
|
on duplicate key update
|
||
|
|
id=values(id),
|
||
|
|
code_name=values(code_name),
|
||
|
|
code_desc=values(code_desc),
|
||
|
|
parent_id=values(parent_id),
|
||
|
|
order_id=values(order_id),
|
||
|
|
create_by=values(create_by),
|
||
|
|
create_time=values(create_time),
|
||
|
|
update_by=values(update_by),
|
||
|
|
update_time=values(update_time),
|
||
|
|
user_id=values(user_id),
|
||
|
|
dept_id=values(dept_id),
|
||
|
|
sass_id=values(sass_id),
|
||
|
|
extend1=values(extend1),
|
||
|
|
extend2=values(extend2)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<!-- 更新数据 -->
|
||
|
|
<update id="update">
|
||
|
|
update sys_auto_code
|
||
|
|
<set>
|
||
|
|
|
||
|
|
<if test="codeName != null and codeName != ''">
|
||
|
|
code_name = #{codeName},
|
||
|
|
</if>
|
||
|
|
<if test="codeDesc != null and codeDesc != ''">
|
||
|
|
code_desc = #{codeDesc},
|
||
|
|
</if>
|
||
|
|
<if test="parentId != null and parentId != ''">
|
||
|
|
parent_id = #{parentId},
|
||
|
|
</if>
|
||
|
|
<if test="orderId != null and orderId != ''">
|
||
|
|
order_id = #{orderId},
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
create_by = #{createBy},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null and createTime != ''">
|
||
|
|
create_time = #{createTime},
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null and updateBy != ''">
|
||
|
|
update_by = #{updator},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
update_time = sysdate(),
|
||
|
|
|
||
|
|
<if test="userId != null and userId != ''">
|
||
|
|
user_id = #{userId},
|
||
|
|
</if>
|
||
|
|
<if test="deptId != null and deptId != ''">
|
||
|
|
dept_id = #{deptId},
|
||
|
|
</if>
|
||
|
|
<if test="sassId != null and sassId != ''">
|
||
|
|
sass_id = #{sassId},
|
||
|
|
</if>
|
||
|
|
<if test="extend1 != null and extend1 != ''">
|
||
|
|
extend1 = #{extend1},
|
||
|
|
</if>
|
||
|
|
<if test="extend2 != null and extend2 != ''">
|
||
|
|
extend2 = #{extend2},
|
||
|
|
</if>
|
||
|
|
<if test="codeValue != null and codeValue != ''">
|
||
|
|
code_value = #{codeValue},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
</set>
|
||
|
|
where id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<!--通过主键删除-->
|
||
|
|
<delete id="deleteById">
|
||
|
|
delete from sys_auto_code where id = #{id}
|
||
|
|
</delete>
|
||
|
|
</mapper>
|