102 lines
3.2 KiB
XML
102 lines
3.2 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.adc.da.sys.dao.mysql.UserOrgEODao" >
|
|
<!-- Result Map-->
|
|
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.UserOrgEO" >
|
|
<id column="user_id" property="userId" />
|
|
<result column="org_id" property="orgId" />
|
|
</resultMap>
|
|
|
|
<!-- TR_USER_ORG table all fields -->
|
|
<sql id="Base_Column_List" >
|
|
user_id, org_id
|
|
</sql>
|
|
|
|
<!-- 查询条件 -->
|
|
<sql id="Base_Where_Clause">
|
|
where 1=1
|
|
<trim suffixOverrides="," >
|
|
<if test="userId != null" >
|
|
and `user_id` ${userIdOperator} #{userId}
|
|
</if>
|
|
<if test="orgId != null" >
|
|
and `org_id` ${orgIdOperator} #{orgId}
|
|
</if>
|
|
</trim>
|
|
</sql>
|
|
|
|
<!-- 插入记录 -->
|
|
<insert id="insert" parameterType="com.adc.da.sys.entity.UserOrgEO" >
|
|
insert into TR_USER_ORG(<include refid="Base_Column_List" />)
|
|
values (#{userId}, #{orgId})
|
|
</insert>
|
|
|
|
<!-- 根据pk,修改记录-->
|
|
<update id="updateByPrimaryKey" parameterType="com.adc.da.sys.entity.UserOrgEO" >
|
|
update TR_USER_ORG
|
|
set `org_id` = #{orgId}
|
|
where `user_id` = #{userId}
|
|
</update>
|
|
|
|
<!-- 修改记录,只修改只不为空的字段 -->
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.sys.entity.UserOrgEO" >
|
|
update TR_USER_ORG
|
|
<set >
|
|
<if test="orgId != null" >
|
|
org_id = #{orgId},
|
|
</if>
|
|
</set>
|
|
where user_id = #{userId}
|
|
</update>
|
|
|
|
<!-- 根据id查询 TR_USER_ORG -->
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
|
select <include refid="Base_Column_List" />
|
|
from TR_USER_ORG
|
|
where user_id = #{value}
|
|
|
|
</select>
|
|
|
|
<!-- 删除记录 -->
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete from TR_USER_ORG
|
|
where user_id = #{value}
|
|
|
|
</delete>
|
|
|
|
<!-- TR_USER_ORG 列表总数-->
|
|
<select id="queryByCount" resultType="java.lang.String" parameterType="com.adc.da.base.page.BasePage">
|
|
select count(1) from TR_USER_ORG
|
|
<include refid="Base_Where_Clause"/>
|
|
</select>
|
|
|
|
<!-- 查询TR_USER_ORG列表 -->
|
|
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
|
select <include refid="Base_Column_List"/> from (select t.*,rownum rownu from TR_USER_ORG t
|
|
where rownum<=${pager.endIndex})tt
|
|
where tt.rownu>=${pager.startIndex}
|
|
</select>
|
|
|
|
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
|
select <include refid="Base_Column_List"/>
|
|
from TR_USER_ORG
|
|
<include refid="Base_Where_Clause"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
|
${pager.orderCondition}
|
|
</if>
|
|
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''" >
|
|
${pager.mysqlQueryCondition}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 插入记录 -->
|
|
<insert id="insertBatch" parameterType="com.adc.da.sys.entity.UserOrgEO" >
|
|
insert into TR_USER_ORG(<include refid="Base_Column_List" />)values
|
|
<foreach collection="userOrgEOList" item="ur" separator=",">
|
|
(#{ur.userId}, #{ur.orgId})
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
</mapper>
|