Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 33b70c3c
authored
Nov 17, 2020
by
sunxiwang
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
员工活码列表查询sql调整,添加条件查询
1 parent
0be2845f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
15 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeEmpleCode.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeEmpleCodeUseScop.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeEmpleCodeServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeEmpleCodeMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeEmpleCodeUseScopMapper.xml
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeEmpleCode.java
View file @
33b70c3
...
...
@@ -59,5 +59,11 @@ public class WeEmpleCode extends BaseEntity
/** 二维码链接 */
private
String
qrCode
;
/** 使用员工姓名 */
@TableField
(
exist
=
false
)
private
String
useUserName
;
/** 使用员工手机号 */
@TableField
(
exist
=
false
)
private
String
mobile
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeEmpleCodeUseScop.java
View file @
33b70c3
...
...
@@ -39,8 +39,7 @@ public class WeEmpleCodeUseScop
private
Integer
delFlag
=
new
Integer
(
0
);
/** 活码使用人员名称 */
@TableField
(
exist
=
false
)
private
String
userUserName
;
private
String
businessName
;
/** 活码使用人员手机号 */
@TableField
(
exist
=
false
)
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeEmpleCodeServiceImpl.java
View file @
33b70c3
...
...
@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 员工活码Service业务层处理
...
...
@@ -55,7 +56,21 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
*/
@Override
public
List
<
WeEmpleCode
>
selectWeEmpleCodeList
(
WeEmpleCode
weEmpleCode
)
{
return
this
.
baseMapper
.
selectWeEmpleCodeList
(
weEmpleCode
);
List
<
WeEmpleCode
>
weEmpleCodeList
=
this
.
baseMapper
.
selectWeEmpleCodeList
(
weEmpleCode
);
if
(
weEmpleCodeList
!=
null
){
weEmpleCodeList
.
forEach
(
empleCode
->{
List
<
WeEmpleCodeUseScop
>
weEmpleCodeUseScopList
=
empleCode
.
getWeEmpleCodeUseScops
();
if
(
CollectionUtil
.
isNotEmpty
(
weEmpleCodeUseScopList
)){
String
useUserName
=
weEmpleCodeUseScopList
.
stream
().
map
(
WeEmpleCodeUseScop:
:
getBusinessName
)
.
collect
(
Collectors
.
joining
(
","
));
empleCode
.
setUseUserName
(
useUserName
);
String
mobile
=
weEmpleCodeUseScopList
.
stream
().
map
(
WeEmpleCodeUseScop:
:
getMobile
)
.
collect
(
Collectors
.
joining
(
","
));
empleCode
.
setMobile
(
mobile
);
}
});
}
return
weEmpleCodeList
;
}
/**
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeEmpleCodeMapper.xml
View file @
33b70c3
...
...
@@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"qrCode"
column=
"qr_code"
/>
<collection
property=
"weEmpleCodeUseScops"
ofType=
"com.linkwechat.wecom.domain.WeEmpleCodeUseScop"
>
<result
property=
"businessId"
column=
"business_id"
/>
<result
property=
"
userUserName"
column=
"user_n
ame"
/>
<result
property=
"
businessName"
column=
"business_
ame"
/>
<result
property=
"mobile"
column=
"mobile"
/>
</collection>
<collection
property=
"weEmpleCodeTags"
ofType=
"com.linkwechat.wecom.domain.WeEmpleCodeTag"
>
...
...
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wecode.config_id,
wecode.qr_code,
wecusn.business_id,
wecusn.
user
_name,
wecusn.
business
_name,
wecusn.mobile,
wect.tag_id,
wect.tag_name
...
...
@@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
we_emple_code wecode
left join (
SELECT
wecus.emple_code_id, wecus.business_id, w
u.user
_name,wu.mobile
wecus.emple_code_id, wecus.business_id, w
ecus.business
_name,wu.mobile
FROM
we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON
...
...
@@ -66,11 +66,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectWeEmpleCodeList"
parameterType=
"WeEmpleCode"
resultMap=
"WeEmpleCodeResult"
>
<include
refid=
"selectWeEmpleCodeLsit"
/>
<where>
<if
test=
"codeType != null "
>
and code_type = #{codeType}
</if>
<if
test=
"isJoinConfirmFriends != null "
>
and is_join_confirm_friends = #{isJoinConfirmFriends}
</if>
<if
test=
"activityScene != null and activityScene != ''"
>
and activity_scene = #{activityScene}
</if>
<if
test=
"welcomeMsg != null "
>
and welcome_msg = #{welcomeMsg}
</if>
<where>
<if
test=
"codeType != null "
>
and wecode.code_type = #{codeType}
</if>
<if
test=
"isJoinConfirmFriends != null "
>
and wecode.is_join_confirm_friends = #{isJoinConfirmFriends}
</if>
<if
test=
"activityScene != null and activityScene != ''"
>
and wecode.activity_scene like concat('%', #{activityScene}, '%')
</if>
<if
test=
"welcomeMsg != null "
>
and wecode.welcome_msg = #{welcomeMsg}
</if>
<if
test=
"createBy != null and createBy !=''"
>
AND wecode.create_by like concat('%', #{createBy}, '%')
</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
AND date_format(wecode.create_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
</if>
<if
test=
"endTime != null and endTime != ''"
>
<!-- 结束时间检索 -->
AND date_format(wecode.create_time,'%y%m%d')
<
= date_format(#{endTime},'%y%m%d')
</if>
<if
test=
"mobile != null and mobile !=''"
>
AND wecusn.mobile like concat('%', #{mobile}, '%')
</if>
<if
test=
"useUserName != null and useUserName !=''"
>
AND wecusn.business_name like concat('%', #{useUserName}, '%')
</if>
</where>
</select>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeEmpleCodeUseScopMapper.xml
View file @
33b70c3
...
...
@@ -9,7 +9,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"empleCodeId"
column=
"emple_code_id"
/>
<result
property=
"businessId"
column=
"business_id"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"userUserName"
column=
"user_name"
/>
<result
property=
"businessName"
column=
"business_name"
/>
<result
property=
"mobile"
column=
"mobile"
/>
</resultMap>
<sql
id=
"selectWeEmpleCodeUseScopVo"
>
...
...
@@ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectWeEmpleCodeUseScopListById"
parameterType=
"Long"
resultMap=
"WeEmpleCodeUseScopResult"
>
SELECT
wecus.id, wecus.emple_code_id,wecus.business_id,w
u.user_nam
e
wecus.id, wecus.emple_code_id,wecus.business_id,w
ecus.business_name,wu.mobil
e
FROM
we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON wu.user_id = wecus.business_id
...
...
@@ -38,12 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"id != null"
>
id,
</if>
<if
test=
"empleCodeId != null"
>
emple_code_id,
</if>
<if
test=
"businessId != null"
>
business_id,
</if>
<if
test=
"businessName != null"
>
business_name,
</if>
<if
test=
"delFlag != null"
>
del_flag,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"empleCodeId != null"
>
#{empleCodeId},
</if>
<if
test=
"businessId != null"
>
#{businessId},
</if>
<if
test=
"businessName != null"
>
#{businessName},
</if>
<if
test=
"delFlag != null"
>
#{delFlag},
</if>
</trim>
</insert>
...
...
@@ -53,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"empleCodeId != null"
>
emple_code_id = #{empleCodeId},
</if>
<if
test=
"businessId != null"
>
business_id = #{businessId},
</if>
<if
test=
"businessName != null"
>
business_name = #{businessName},
</if>
<if
test=
"delFlag != null"
>
del_flag = #{delFlag},
</if>
</trim>
where id = #{id}
...
...
@@ -70,10 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<insert
id=
"batchInsetWeEmpleCodeUseScop"
>
insert into we_emple_code_use_scop (id,emple_code_id,business_id,del_flag)
insert into we_emple_code_use_scop (id,emple_code_id,business_id,
business_name,
del_flag)
values
<foreach
collection=
"weEmpleCodeUseScops"
item=
"scop"
index=
"index"
separator=
","
>
(#{scop.id},#{scop.empleCodeId},#{scop.businessId},#{scop.delFlag})
(#{scop.id},#{scop.empleCodeId},#{scop.businessId},#{scop.
businessName},#{scop.
delFlag})
</foreach>
</insert>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment