|
|
@@ -5,12 +5,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<mapper namespace="com.ruoyi.dz.mapper.DzAgentMapper">
|
|
|
|
|
|
<resultMap type="DzAgent" id="DzAgentResult">
|
|
|
- <result property="agentId" column="agentId" />
|
|
|
- <result property="deptId" column="deptId" />
|
|
|
- <result property="userId" column="userId" />
|
|
|
+ <result property="agentId" column="agent_id" />
|
|
|
+ <result property="deptId" column="dept_id" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
<result property="name" column="name" />
|
|
|
<result property="phonenumber" column="phonenumber" />
|
|
|
- <result property="parentId" column="parentId" />
|
|
|
+ <result property="parentId" column="parent_id" />
|
|
|
<result property="schools" column="schools" />
|
|
|
<result property="remark" column="remark" />
|
|
|
<association property="dept" javaType="SysDept" resultMap="deptResult" />
|
|
|
@@ -27,37 +27,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectDzAgentVo">
|
|
|
- select t1.agentId, t1.deptId, t1.userId, t1.name, t1.phonenumber, t1.parentId, t1.schools, t1.remark,
|
|
|
+ select t1.agent_id, t1.dept_id, t1.user_id, t1.name, t1.phonenumber, t1.parent_id, t1.schools, t1.remark,
|
|
|
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status
|
|
|
from dz_agent t1
|
|
|
- left join sys_dept d on t1.deptId = d.dept_id
|
|
|
+ left join sys_dept d on t1.dept_id = d.dept_id
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectDzAgentList" parameterType="DzAgent" resultMap="DzAgentResult">
|
|
|
<include refid="selectDzAgentVo"/>
|
|
|
<where>
|
|
|
- <if test="userId != null "> and t1.userId = #{userId}</if>
|
|
|
- <if test="deptId != null "> and t1.deptId = #{deptId}</if>
|
|
|
+ <if test="userId != null "> and t1.user_id = #{userId}</if>
|
|
|
+<!-- <if test="deptId != null "> and t1.dept_id = #{deptId}</if>-->
|
|
|
+ <if test="deptId != null ">
|
|
|
+ AND (t1.dept_id = #{deptId} OR t1.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
|
|
|
+ </if>
|
|
|
<if test="name != null and name != ''"> and t1.name like concat('%', #{name}, '%')</if>
|
|
|
<if test="phonenumber != null and phonenumber != ''"> and t1.phonenumber like concat('%', #{phonenumber}, '%')</if>
|
|
|
- <if test="parentId != null "> and t1.parentId = #{parentId}</if>
|
|
|
+ <if test="parentId != null "> and t1.parent_id = #{parentId}</if>
|
|
|
<if test="schools != null and schools != ''"> and t1.schools = #{schools}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectDzAgentByAgentId" parameterType="Long" resultMap="DzAgentResult">
|
|
|
<include refid="selectDzAgentVo"/>
|
|
|
- where t1.agentId = #{agentId}
|
|
|
+ where t1.agent_id = #{agentId}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertDzAgent" parameterType="DzAgent" useGeneratedKeys="true" keyProperty="agentId">
|
|
|
+ <insert id="insertDzAgent" parameterType="DzAgent" useGeneratedKeys="true" keyProperty="agent_id">
|
|
|
insert into dz_agent
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="deptId != null">deptId,</if>
|
|
|
- <if test="userId != null">userId,</if>
|
|
|
+ <if test="deptId != null">dept_id,</if>
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
<if test="name != null">name,</if>
|
|
|
<if test="phonenumber != null">phonenumber,</if>
|
|
|
- <if test="parentId != null">parentId,</if>
|
|
|
+ <if test="parentId != null">parent_id,</if>
|
|
|
<if test="schools != null">schools,</if>
|
|
|
<if test="remark != null">remark,</if>
|
|
|
</trim>
|
|
|
@@ -75,23 +78,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<update id="updateDzAgent" parameterType="DzAgent">
|
|
|
update dz_agent
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="userId != null">userId = #{userId},</if>
|
|
|
- <if test="deptId != null">deptId = #{deptId},</if>
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="deptId != null">dept_id = #{deptId},</if>
|
|
|
<if test="name != null">name = #{name},</if>
|
|
|
<if test="phonenumber != null">phonenumber = #{phonenumber},</if>
|
|
|
- <if test="parentId != null">parentId = #{parentId},</if>
|
|
|
+ <if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
<if test="schools != null">schools = #{schools},</if>
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
</trim>
|
|
|
- where agentId = #{agentId}
|
|
|
+ where agent_id = #{agentId}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteDzAgentByAgentId" parameterType="Long">
|
|
|
- delete from dz_agent where agentId = #{agentId}
|
|
|
+ delete from dz_agent where agent_id = #{agentId}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteDzAgentByAgentIds" parameterType="String">
|
|
|
- delete from dz_agent where agentId in
|
|
|
+ delete from dz_agent where agent_id in
|
|
|
<foreach item="agentId" collection="array" open="(" separator="," close=")">
|
|
|
#{agentId}
|
|
|
</foreach>
|