agent-role-mapper.xml
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?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">
<!-- 机构角色对应关系 @author kongmingke -->
<mapper namespace="com.cjs.cms.dao.admin.AgentRoleDao">
<sql id="agent_role_field">
id, agent_no, role_id
</sql>
<sql id="searchCondition">
WHERE agentinfo_role.role_id = role.id
<if test="agentNo != null and agentNo != ''"> AGENT_NO = #{agentNo} </if>
</sql>
<select id="search" parameterType="map" resultType="AgentRoleInfo">
SELECT agentinfo_role.id, agent_no, role_id, role_name
FROM agentinfo_role , role
WHERE agentinfo_role.role_id = role.id
ORDER BY AGENT_NO
<include refid="common.pageLimit" />
</select>
<select id="searchTotal" parameterType="map" resultType="int">
SELECT COUNT(*)
FROM agentinfo_role , role
WHERE agentinfo_role.role_id = role.id
</select>
<insert id="addAgentRole" parameterType="AgentRoleInfo">
insert into agentinfo_role(agent_no, role_id)
values(#{agentNo}, #{roleId})
</insert>
<update id="updateAgentRole" parameterType="AgentRoleInfo">
update agentinfo_role
set
agent_no = #{agentNo}, role_id = #{roleId}
where id = #{id}
</update>
</mapper>