<?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.newfiber.api.pc.dao.Sys_RolesDao" > <sql id = "Roles_sql"> from sys_roles <where> 1=1 <if test="fuzzyQuery!=null"> AND (role_no like '%${fuzzyQuery}%' OR role_name like '%${fuzzyQuery}%') </if> </where> </sql> <sql id="op"> <choose> <when test="sort!=null and sort != ''"> ${sort} </when> <otherwise> serial </otherwise> </choose> </sql> <sql id="oc"> <choose> <when test="order !=null and order != ''"> ${order} </when> <otherwise> DESC </otherwise> </choose> </sql> <select id="selectRoleList" parameterType="com.newfiber.api.pc.model.entity.Sys_Roles" resultType="com.newfiber.api.pc.model.entity.Sys_Roles"> select * <include refid="Roles_sql"></include> order by <include refid="op"></include> <include refid="oc"></include> <if test="pageNo != 0 and pageSize != 0"> limit #{pageNo}, #{pageSize} </if> </select> <select id="GetRoleCount" parameterType="com.newfiber.api.pc.model.entity.Sys_Roles" resultType="int"> SELECT COUNT(DISTINCT serial) total <include refid="Roles_sql"></include> </select> <insert id="inertRole" parameterType="com.newfiber.api.pc.model.entity.Sys_Roles" > insert into sys_roles <trim prefix="(" suffix=")" suffixOverrides="," > <if test="roleNo != null" > role_no, </if> <if test="roleName != null" > role_name, </if> <if test="roleType != null" > role_type, </if> <if test="roleTypeZn != null" > role_type_zn, </if> <if test="roleState != null" > role_state, </if> <if test="roleStateZn != null" > role_state_zn, </if> <if test="remark!=null"> remark, </if> <if test="orderSort != null" > order_sort, </if> <if test="createTime!=null"> create_time, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="roleNo != null" > #{roleNo,jdbcType=VARCHAR}, </if> <if test="roleName != null" > #{roleName,jdbcType=VARCHAR}, </if> <if test="roleType != null" > #{roleType,jdbcType=INTEGER}, </if> <if test="roleTypeZn != null" > #{roleTypeZn,jdbcType=VARCHAR}, </if> <if test="roleState != null" > #{roleState,jdbcType=INTEGER}, </if> <if test="roleStateZn != null" > #{roleStateZn,jdbcType=VARCHAR}, </if> <if test="remark!=null"> #{remark,jdbcType=VARCHAR}, </if> <if test="orderSort != null" > #{orderSort,jdbcType=VARCHAR}, </if> <if test="createTime!=null"> #{createTime,jdbcType=TIMESTAMP}, </if> </trim> </insert> <update id="updateRole" parameterType="com.newfiber.api.pc.model.entity.Sys_Roles" > update sys_roles <set > <if test="roleNo != null" > role_no =#{roleNo,jdbcType=VARCHAR}, </if> <if test="roleName != null" > role_name =#{roleName,jdbcType=VARCHAR}, </if> <if test="roleType != null" > role_type =#{roleType,jdbcType=INTEGER}, </if> <if test="roleTypeZn != null" > role_type_zn =#{roleTypeZn,jdbcType=VARCHAR}, </if> <if test="roleState != null" > role_state =#{roleState,jdbcType=INTEGER}, </if> <if test="roleStateZn != null" > role_state_zn =#{roleStateZn,jdbcType=VARCHAR}, </if> <if test="remark!=null"> remark =#{remark,jdbcType=VARCHAR}, </if> <if test="orderSort != null" > order_sort =#{orderSort,jdbcType=INTEGER}, </if> <if test="updateTime!=null"> update_time =#{updateTime,jdbcType=TIMESTAMP}, </if> </set> where serial = #{serial,jdbcType=BIGINT} </update> <delete id="deleteRole" parameterType="java.lang.Long"> delete from sys_roles where serial in <foreach collection="list" item="item" separator="," open="(" close=")"> #{item} </foreach> </delete> </mapper>