SyncMapper.xml
5.43 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?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.sincere.smartSearch.mapper.SyncMapper">
<resultMap id="SyncSchoolDto" type="com.sincere.common.dto.smartCampus.SyncSchoolDto">
<result column="SchoolId_XX" property="schoolId"/>
<result column="SchoolName" property="schoolName"/>
<result column="SchoolId_YXT" property="yxtId"/>
<result column="IsAllPush" property="push"/>
</resultMap>
<select id="selectSyncSchool" resultMap="SyncSchoolDto">
select SchoolId_XX , SchoolName , SchoolId_YXT , IsAllPush from HS_SchoolRelated where SchoolId_YXT is not null
and SchoolId_YXT != ''
</select>
<update id="updateSchool" parameterType="java.lang.Integer">
update HS_SchoolRelated set IsAllPush = 1 where SchoolId_XX = #{schoolId}
</update>
<resultMap id="GroupDto" type="com.sincere.common.dto.smartCampus.GroupDto">
<result column="group_id" property="groupId"/>
<result column="group_name" property="groupName"/>
<result column="p_id" property="pId"/>
</resultMap>
<select id="selectGroup" parameterType="java.lang.Integer" resultMap="GroupDto">
select group_id , group_name , p_id from SZ_TeaGroup where state=1 and school_id = #{schoolId}
</select>
<select id="selectSubject" parameterType="java.lang.Integer" resultType="java.lang.String">
select DISTINCT subject_name from SZ_Subject where school_id = #{schoolId} and Status = 1
</select>
<resultMap id="DeptDto" type="com.sincere.common.dto.smartCampus.SyncDeptDto">
<result column="ID" property="id"/>
<result column="Dept_id" property="deptId"/>
<result column="schoolid" property="schoolId"/>
<result column="Dept_name" property="deptName"/>
<result column="UpdateType" property="updateType"/>
<result column="gradeId" property="gradeId"/>
<result column="usertype" property="userType"/>
</resultMap>
<select id="selectDept" parameterType="java.lang.Integer" resultMap="DeptDto">
select ID , Dept_id , schoolid , Dept_name ,UpdateType ,gradeId , usertype from HS_TeaGroupUpdate where schoolid
= #{schoolId}
and yxy_is_new = 0 order by ID
</select>
<select id="selectDeptByGradeId" parameterType="java.lang.Integer" resultMap="DeptDto">
select ID , Dept_id , schoolid , Dept_name ,UpdateType ,gradeId , usertype from HS_TeaGroupUpdate
where gradeId = #{gradeId}
</select>
<update id="updateDept" parameterType="java.lang.Integer">
update HS_TeaGroupUpdate set yxy_is_new = 1 where ID = #{id}
</update>
<update id="updateUser" parameterType="java.lang.Integer">
update HS_StudentUpdateCard set Yxy_IsNew = 1 where ID = #{id}
</update>
<resultMap id="UserDtp" type="com.sincere.common.dto.smartCampus.SyncUserDto">
<result column="ID" property="id"/>
<result column="UserType" property="userType"/>
<result column="Name" property="name"/>
<result column="ClassId" property="classId"/>
<result column="CustomerId" property="customerId"/>
<result column="Sex" property="sex"/>
<result column="mobile" property="mobile"/>
<result column="UpdateType" property="updateType"/>
<result column="yxyUserId" property="yxyUserId"/>
</resultMap>
<select id="selectUser" parameterType="java.lang.Integer" resultMap="UserDtp">
select HS_StudentUpdateCard.ID , HS_StudentUpdateCard.UserType , HS_StudentUpdateCard.Name ,
HS_StudentUpdateCard.ClassId , HS_StudentUpdateCard.CustomerId , HS_StudentUpdateCard.Sex ,
HS_StudentUpdateCard.mobile , HS_StudentUpdateCard.UpdateType , YXT_UserRelation.yxyUserId from
HS_StudentUpdateCard
left join YXT_UserRelation on HS_StudentUpdateCard.CustomerId = YXT_UserRelation.hxyCustomerId
where SchoolId =#{schoolId} and Yxy_IsNew = 0
</select>
<insert id="insertDeptRelation" parameterType="com.sincere.common.dto.smartCampus.DeptRelationDto">
insert into YXT_DeptRelation (hxyDeptId,yxyDeptId,usertype,updateTime,createTime,state)
values (#{hxyDeptId},#{yxyDeptId},#{userType},GETDATE(),GETDATE(),#{state})
</insert>
<update id="updateDeptRelation" parameterType="com.sincere.common.dto.smartCampus.DeptRelationDto">
update YXT_DeptRelation set updateTime = GETDATE() , state = #{state} where hxyDeptId = #{hxyDeptId}
</update>
<select id="selectYxyIdByHxyId" parameterType="java.lang.Integer" resultType="java.lang.String">
select yxyDeptId from YXT_DeptRelation where hxyDeptId = #{hxyDeptId}
</select>
<insert id="insertUserRelation" parameterType="com.sincere.common.dto.smartCampus.UserRelationDto">
insert into YXT_UserRelation (hxyCustomerId,yxyUserId,userType,updateTime,createTime,state)
values (#{hxyCustomerId},#{yxyUserId},#{userType},GETDATE(),GETDATE(),#{state})
</insert>
<update id="updateUserRelation" parameterType="com.sincere.common.dto.smartCampus.DeptRelationDto">
update YXT_UserRelation set updateTime = GETDATE() , state = #{state} where hxyCustomerId = #{hxyCustomerId}
</update>
<select id="selectUserYxyIdByHxyId" parameterType="java.lang.String" resultType="java.lang.String">
select yxyUserId from YXT_UserRelation where hxyCustomerId = #{hxyCustomerId}
</select>
</mapper>