<?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_OrganizationDao" > <sql id = "Organization_sql"> FROM sys_organization a <where> 1=1 <if test="fuzzyQuery!=null"> AND (a.org_no like '%${fuzzyQuery}%' OR a.org_name like '%${fuzzyQuery}%') </if> </where> </sql> <select id="GetOrgCount" parameterType="com.newfiber.api.pc.model.entity.SysOrganization" resultType="int"> SELECT COUNT(DISTINCT serial) total <include refid="Organization_sql"></include> </select> <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="selectOrganization" parameterType="com.newfiber.api.pc.model.entity.SysOrganization" resultType="com.newfiber.api.pc.model.entity.SysOrganization"> select * <include refid="Organization_sql"></include> order by <include refid="op"></include> <include refid="oc"></include> limit #{pageNo}, #{pageSize} </select> <insert id="insertOrg" parameterType="com.newfiber.api.pc.model.entity.SysOrganization" > insert into sys_organization <trim prefix="(" suffix=")" suffixOverrides="," > <if test="orgNo != null" > org_no, </if> <if test="orgName != null" > org_name, </if> <if test="orgType != null" > org_type, </if> <if test="orgTypeZn != null" > org_type_zn, </if> <if test="orgState != null" > org_state, </if> <if test="orgStateZn != null" > org_state_zn, </if> <if test="address != null" > address, </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="orgNo != null" > #{orgNo,jdbcType=VARCHAR}, </if> <if test="orgName != null" > #{orgName,jdbcType=VARCHAR}, </if> <if test="orgType != null" > #{orgType,jdbcType=INTEGER}, </if> <if test="orgTypeZn != null" > #{orgTypeZn,jdbcType=VARCHAR}, </if> <if test="orgState != null" > #{orgState,jdbcType=INTEGER}, </if> <if test="orgStateZn != null" > #{orgStateZn,jdbcType=VARCHAR}, </if> <if test="address != null" > #{address,jdbcType=VARCHAR}, </if> <if test="remark != null" > #{remark,jdbcType=VARCHAR}, </if> <if test="orderSort != null" > #{orderSort,jdbcType=INTEGER}, </if> <if test="createTime!=null"> #{createTime,jdbcType=TIMESTAMP}, </if> </trim> </insert> <update id="updateOrg" parameterType="com.newfiber.api.pc.model.entity.SysOrganization" > update sys_organization <set > <if test="orgNo != null" > org_no =#{orgNo,jdbcType=VARCHAR}, </if> <if test="orgName != null" > org_name =#{orgName,jdbcType=VARCHAR}, </if> <if test="orgType != null" > org_type =#{orgType,jdbcType=INTEGER}, </if> <if test="orgTypeZn != null" > org_type_zn =#{orgTypeZn,jdbcType=VARCHAR}, </if> <if test="orgState != null" > org_state =#{orgState,jdbcType=INTEGER}, </if> <if test="orgStateZn != null" > org_state_zn =#{orgStateZn,jdbcType=VARCHAR}, </if> <if test="address != null" > address =#{address,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="deleteOrg" parameterType="list"> delete from sys_organization where serial in <foreach collection="list" item="item" open="(" separator="," close=")"> #{item} </foreach> </delete> <select id="getOrgByUserNo" parameterType="java.lang.String" resultType="com.newfiber.api.pc.model.entity.SysOrganization"> SELECT org.org_no, org_name FROM sys_organization org LEFT JOIN sys_user_org uorg ON org.org_no=uorg.org_no WHERE uorg.user_no=#{userNo} </select> </mapper>