ganzi-api/inventory-dao/src/main/resources/mapper/SysStatuteMapper.xml
2022-09-16 15:07:17 +08:00

244 lines
8.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.rzyc.mapper.SysStatuteMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.SysStatute">
<result column="statute_id" jdbcType="VARCHAR" property="statuteId" />
<result column="statute_title" jdbcType="VARCHAR" property="statuteTitle" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="statute_sort" jdbcType="INTEGER" property="statuteSort" />
<result column="modified" jdbcType="VARCHAR" property="modified" />
<result column="created" jdbcType="VARCHAR" property="created" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
statute_id, statute_title, parent_id, statute_sort, modified, created, modify_time,
create_time
</sql>
<select id="selectByExample" parameterType="com.rzyc.model.SysStatuteExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_statute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="com.rzyc.model.SysStatuteExample">
delete from sys_statute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.SysStatute">
insert into sys_statute (statute_id, statute_title, parent_id,
statute_sort, modified, created,
modify_time, create_time)
values (#{statuteId,jdbcType=VARCHAR}, #{statuteTitle,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR},
#{statuteSort,jdbcType=INTEGER}, #{modified,jdbcType=VARCHAR}, #{created,jdbcType=VARCHAR},
#{modifyTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.SysStatute">
insert into sys_statute
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="statuteId != null">
statute_id,
</if>
<if test="statuteTitle != null">
statute_title,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="statuteSort != null">
statute_sort,
</if>
<if test="modified != null">
modified,
</if>
<if test="created != null">
created,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="statuteId != null">
#{statuteId,jdbcType=VARCHAR},
</if>
<if test="statuteTitle != null">
#{statuteTitle,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=VARCHAR},
</if>
<if test="statuteSort != null">
#{statuteSort,jdbcType=INTEGER},
</if>
<if test="modified != null">
#{modified,jdbcType=VARCHAR},
</if>
<if test="created != null">
#{created,jdbcType=VARCHAR},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.rzyc.model.SysStatuteExample" resultType="java.lang.Long">
select count(*) from sys_statute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_statute
<set>
<if test="record.statuteId != null">
statute_id = #{record.statuteId,jdbcType=VARCHAR},
</if>
<if test="record.statuteTitle != null">
statute_title = #{record.statuteTitle,jdbcType=VARCHAR},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=VARCHAR},
</if>
<if test="record.statuteSort != null">
statute_sort = #{record.statuteSort,jdbcType=INTEGER},
</if>
<if test="record.modified != null">
modified = #{record.modified,jdbcType=VARCHAR},
</if>
<if test="record.created != null">
created = #{record.created,jdbcType=VARCHAR},
</if>
<if test="record.modifyTime != null">
modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_statute
set statute_id = #{record.statuteId,jdbcType=VARCHAR},
statute_title = #{record.statuteTitle,jdbcType=VARCHAR},
parent_id = #{record.parentId,jdbcType=VARCHAR},
statute_sort = #{record.statuteSort,jdbcType=INTEGER},
modified = #{record.modified,jdbcType=VARCHAR},
created = #{record.created,jdbcType=VARCHAR},
modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<!--法规、法规章节列表-->
<select id="findByParentId" resultMap="BaseResultMap">
SELECT ss.* FROM sys_statute ss
WHERE ss.`statute_title` LIKE #{condition}
<if test="null != parentId and '' != parentId">
AND ss.`parent_id` = #{parentId}
</if>
<if test="null == parentId or '' == parentId">
AND ss.`parent_id` IS NULL
</if>
ORDER BY ss.`statute_sort` ASC
</select>
<!--修改法规-->
<update id="changeStatute">
update sys_statute
set statute_title = #{record.statuteTitle,jdbcType=VARCHAR},
statute_sort = #{record.statuteSort,jdbcType=INTEGER},
modified = #{record.modified,jdbcType=VARCHAR},
modify_time = #{record.modifyTime,jdbcType=TIMESTAMP}
where statute_id = #{record.statuteId,jdbcType=VARCHAR}
</update>
</mapper>