| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <?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.com.goldenwater.dcproj.dao.AttUserBaseDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.AttUserBase" id="attUserBaseResultMap">
- <result property="guid" column="GUID"/>
- <result property="userGuid" column="USER_GUID"/>
- <result property="userCode" column="USER_CODE"/>
- <result property="userName" column="USER_NAME"/>
- <result property="password" column="PASSWORD"/>
- <result property="userType" column="USER_TYPE"/>
- <result property="persId" column="PERS_ID"/>
- <result property="adminOrg" column="ADMIN_ORG"/>
- <result property="status" column="STATUS"/>
- <result property="modifier" column="MODIFIER"/>
- <result property="fromDate" column="FROM_DATE"/>
- <result property="toDate" column="TO_DATE"/>
- <result property="note" column="NOTE"/>
- <result property="nodeCode" column="NODE_CODE"/>
- <result property="isTempUser" column="IS_TEMP_USER"/>
- <result property="userEndDate" column="USER_END_DATE"/>
- </resultMap>
-
- <sql id="table_columns">
- GUID,
- USER_GUID,
- USER_CODE,
- USER_NAME,
- PASSWORD,
- USER_TYPE,
- PERS_ID,
- ADMIN_ORG,
- STATUS,
- MODIFIER,
- FROM_DATE,
- TO_DATE,
- NOTE,
- NODE_CODE,
- IS_TEMP_USER,
- USER_END_DATE
- </sql>
- <sql id="entity_properties">
- #{guid},
- #{userGuid},
- #{userCode},
- #{userName},
- #{password},
- #{userType},
- #{persId},
- #{adminOrg},
- #{status},
- #{modifier},
- #{fromDate},
- #{toDate},
- #{note},
- #{nodeCode},
- #{isTempUser},
- #{userEndDate}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="userGuid != null and userGuid != ''">and USER_GUID = #{userGuid}</if>
- <if test="userCode != null and userCode != ''">and USER_CODE = #{userCode}</if>
- <if test="userName != null and userName != ''">and USER_NAME LIKE concat(concat('%',#{userName}),'%')</if>
- <if test="password != null and password != ''">and PASSWORD = #{password}</if>
- <if test="userType != null and userType != ''">and USER_TYPE = #{userType}</if>
- <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <if test="adminOrg != null and adminOrg != ''">and ADMIN_ORG = #{adminOrg}</if>
- <if test="status != null and status != ''">and STATUS = #{status}</if>
- <if test="modifier != null and modifier != ''">and MODIFIER = #{modifier}</if>
- <if test="fromDate != null">and FROM_DATE = #{fromDate}</if>
- <if test="toDate != null">and TO_DATE = #{toDate}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="nodeCode != null and nodeCode != ''">and NODE_CODE = #{nodeCode}</if>
- <if test="isTempUser != null and isTempUser != ''">and IS_TEMP_USER = #{isTempUser}</if>
- <if test="userEndDate != null">and USER_END_DATE = #{userEndDate}</if>
- </trim>
- </sql>
- <select id="get" resultMap="attUserBaseResultMap" parameterType="String" >
- select <include refid="table_columns" /> from att_user_base where GUID = #{id}
- </select>
- <select id="getBy" resultMap="attUserBaseResultMap">
- select <include refid="table_columns" /> from att_user_base <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="attUserBaseResultMap">
- select <include refid="table_columns" /> from att_user_base
- </select>
- <select id="findList" resultMap="attUserBaseResultMap">
- select <include refid="table_columns" /> from att_user_base <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(GUID) from att_user_base <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttUserBase">
- insert into att_user_base( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from att_user_base where GUID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttUserBase">
- delete from att_user_base <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update att_user_base set flag_valid = 0 where GUID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttUserBase">
- update att_user_base
- <trim prefix="set" suffixOverrides=",">
- <if test="userGuid != null and userGuid != ''">USER_GUID = #{userGuid},</if>
- <if test="userCode != null and userCode != ''">USER_CODE = #{userCode},</if>
- <if test="userName != null and userName != ''">USER_NAME = #{userName},</if>
- <if test="password != null and password != ''">PASSWORD = #{password},</if>
- <if test="userType != null and userType != ''">USER_TYPE = #{userType},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="adminOrg != null and adminOrg != ''">ADMIN_ORG = #{adminOrg},</if>
- <if test="status != null and status != ''">STATUS = #{status},</if>
- <if test="modifier != null and modifier != ''">MODIFIER = #{modifier},</if>
- <if test="fromDate != null">FROM_DATE = #{fromDate},</if>
- <if test="toDate != null">TO_DATE = #{toDate},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="nodeCode != null and nodeCode != ''">NODE_CODE = #{nodeCode},</if>
- <if test="isTempUser != null and isTempUser != ''">IS_TEMP_USER = #{isTempUser},</if>
- <if test="userEndDate != null">USER_END_DATE = #{userEndDate},</if>
- </trim>
- <where>GUID = #{guid}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttUserBase">
- update att_user_base
- <trim prefix="set" suffixOverrides=",">
- <if test="userGuid != null and userGuid != ''">USER_GUID = #{userGuid},</if>
- <if test="userCode != null and userCode != ''">USER_CODE = #{userCode},</if>
- <if test="userName != null and userName != ''">USER_NAME = #{userName},</if>
- <if test="password != null and password != ''">PASSWORD = #{password},</if>
- <if test="userType != null and userType != ''">USER_TYPE = #{userType},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="adminOrg != null and adminOrg != ''">ADMIN_ORG = #{adminOrg},</if>
- <if test="status != null and status != ''">STATUS = #{status},</if>
- <if test="modifier != null and modifier != ''">MODIFIER = #{modifier},</if>
- <if test="fromDate != null">FROM_DATE = #{fromDate},</if>
- <if test="toDate != null">TO_DATE = #{toDate},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="nodeCode != null and nodeCode != ''">NODE_CODE = #{nodeCode},</if>
- <if test="isTempUser != null and isTempUser != ''">IS_TEMP_USER = #{isTempUser},</if>
- <if test="userEndDate != null">USER_END_DATE = #{userEndDate},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <sql id="orgIdSql">
- <choose>
- <when test="orgId !=null and orgId !=''">
- and ORG_ID=#{orgId}
- </when>
- <otherwise>
- and ORG_ID is null
- </otherwise>
- </choose>
- </sql>
- <!--根据用户id获取该用户是否为管理员-->
- <select id="getPersById" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.PersBaseDto">
- SELECT A.GUID persid,A.PERMISSION permission FROM BIS_INSP_ALL_RLATION_PERS A WHERE A.GUID = #{persid}
- </select>
- <!--获取管理员所在组-->
- <select id="getLastLeafPoint" resultType="cn.com.goldenwater.dcproj.dto.PersGroupDto">
- select j.* from BIS_INSP_ALL j where j.id like '${ptype}${orgId}______'
- <if test="groupName !=null and groupName !=''">
- and j.pnm like '%${groupName}%'
- </if>
- order by j.id asc
- </select>
- <select id="getpersGroup" resultType="cn.com.goldenwater.dcproj.dto.PersGroupDto">
- SELECT DISTINCT T1.ID,T1.NM,T1.PNM,T1.PPNM,CONCAT(CONCAT(CONCAT(CONCAT(T1.PPNM,'-'),T1.PNM),'-'),T1.NM) AS resultName from
- (SELECT A.ID,A.PNM NM,C.ID PID,C.PNM,D.ID PPID,D.PNM PPNM FROM BIS_INSP_ALL A LEFT JOIN BIS_INSP_ALL_RLATION B ON A.ID = B.ID
- LEFT JOIN BIS_INSP_ALL C ON A.PID = C.ID
- LEFT JOIN BIS_INSP_ALL D ON C.PID = D.ID
- WHERE 1 = 1
- AND REGEXP_LIKE(
- A.Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persid} <include refid="orgIdSql"/>
- and id like '${ptype}%')>0 then
- (SELECT listagg(id, '|' ) as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persid} <include refid="orgIdSql"/> and id like '${ptype}%' group by persid)
- else (select 'non' from dual) end)
- ||')')
- AND A.ID LIKE '${ptype}${orgId}%' AND LENGTH(A.ID) = 12
- <if test="tabType =='2'.toString()">
- and A.entm <to_date(#{nowTime},'yyyy-MM-dd')+1
- </if>
- <if test="tabType =='1'.toString()">
- and A.entm >=to_date(#{nowTime},'yyyy-MM-dd')F
- </if>
- <include refid="choseSql"/>
- <if test="groupName != null and groupName != ''">and A.PNM LIKE '%${groupName}%'</if>
- <!-- 根据批次Id查询批次下面的组 -->
- <if test="plnaId != null and plnaId != ''">and A.ID LIKE '%${plnaId}%'</if>
- ) T1
- </select>
- <sql id="choseSql">
- <choose>
- <when test="province !=null and province !=''">
- and B.ad_code=#{province}
- </when>
- <otherwise>
- and B.ad_code is null
- </otherwise>
- </choose>
- </sql>
- </mapper>
|