Commit 655c5f95 by sunxiwang

员工活码标签名称修改,员工活码查询列表和详情sql修改

1 parent bc52a609
......@@ -34,7 +34,6 @@ public class WeEmpleCodeTag
private Integer delFlag=new Integer(0);
/** 标签名 */
@TableField(exist = false)
private String tagName;
......
......@@ -42,5 +42,9 @@ public class WeEmpleCodeUseScop
@TableField(exist = false)
private String userUserName;
/** 活码使用人员手机号 */
@TableField(exist = false)
private String mobile;
}
......@@ -24,9 +24,6 @@ import java.util.List;
*/
@Service
public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmpleCode> implements IWeEmpleCodeService {
@Autowired
private WeEmpleCodeMapper weEmpleCodeMapper;
@Autowired
private IWeEmpleCodeTagService weEmpleCodeTagService;
......@@ -47,17 +44,7 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
*/
@Override
public WeEmpleCode selectWeEmpleCodeById(Long id) {
WeEmpleCode weEmpleCode = weEmpleCodeMapper.selectWeEmpleCodeById(id);
if (null != weEmpleCode) {
weEmpleCode.setWeEmpleCodeTags(
weEmpleCodeTagService.selectWeEmpleCodeTagListById(id)
);
weEmpleCode.setWeEmpleCodeUseScops(
iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListById(id)
);
}
return weEmpleCode;
return this.baseMapper.selectWeEmpleCodeById(id);
}
/**
......@@ -92,7 +79,7 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
} catch (Exception e) {
e.printStackTrace();
}
if (weEmpleCodeMapper.insertWeEmpleCode(weEmpleCode) == 1) {
if (this.baseMapper.insertWeEmpleCode(weEmpleCode) == 1) {
if (CollectionUtil.isNotEmpty(weEmpleCode.getWeEmpleCodeUseScops())) {
weEmpleCode.getWeEmpleCodeUseScops().forEach(item -> item.setId(weEmpleCode.getId()));
iWeEmpleCodeUseScopService.saveBatch(weEmpleCode.getWeEmpleCodeUseScops());
......@@ -118,7 +105,7 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
} catch (Exception e) {
e.printStackTrace();
}
if (weEmpleCodeMapper.updateWeEmpleCode(weEmpleCode) == 1) {
if (this.baseMapper.updateWeEmpleCode(weEmpleCode) == 1) {
if (CollectionUtil.isNotEmpty(weEmpleCode.getWeEmpleCodeUseScops())) {
weEmpleCode.getWeEmpleCodeUseScops().forEach(item -> item.setId(weEmpleCode.getId()));
iWeEmpleCodeUseScopService.updateBatchById(weEmpleCode.getWeEmpleCodeUseScops());
......@@ -155,7 +142,7 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
if (weEmpleCode != null && weEmpleCode.getConfigId() != null) {
weExternalContactClient.delContactWay(weEmpleCode.getConfigId());
}
return weEmpleCodeMapper.deleteWeEmpleCodeById(id);
return this.baseMapper.deleteWeEmpleCodeById(id);
}
......@@ -167,7 +154,7 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
*/
@Override
public int batchRemoveWeEmpleCodeIds(List<String> ids) {
return weEmpleCodeMapper.batchRemoveWeEmpleCodeIds(ids);
return this.baseMapper.batchRemoveWeEmpleCodeIds(ids);
}
private WeExternalContactDto.WeContactWay getWeContactWay(WeEmpleCode weEmpleCode) {
......
......@@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="weEmpleCodeUseScops" ofType="com.linkwechat.wecom.domain.WeEmpleCodeUseScop">
<result property="businessId" column="business_id" />
<result property="userUserName" column="user_name" />
<result property="mobile" column="mobile" />
</collection>
<collection property="weEmpleCodeTags" ofType="com.linkwechat.wecom.domain.WeEmpleCodeTag">
<result property="tagId" column="tag_id" />
......@@ -30,44 +31,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="selectWeEmpleCodeLsit">
select
wecode.id,
wecode.code_type,
wecode.is_join_confirm_friends,
wecode.activity_scene,
wecode.welcome_msg,
wecode.create_by,
wecode.create_time,
wecode.del_flag,
wecode.config_id,
wecode.qr_code,
wecusn.business_id,
wecusn.user_name,
wectn.tag_id,
wectn.tag_name
from
we_emple_code wecode
left join (
SELECT
wecus.emple_code_id, wecus.business_id, wu.user_name
FROM
we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON
wu.user_id = wecus.business_id
WHERE
wecus.del_flag = 0
) as wecusn on
wecode.id = wecusn.emple_code_id
left join (
SELECT
wect.tag_id, wect.emple_code_id, wt.`name` as tag_name
FROM
we_emple_code_tag wect
LEFT JOIN we_tag wt ON
wt.tag_id = wect.tag_id
WHERE
wect.del_flag = 0) as wectn on
wecode.id = wectn.emple_code_id
select
wecode.id,
wecode.code_type,
wecode.is_join_confirm_friends,
wecode.activity_scene,
wecode.welcome_msg,
wecode.create_by,
wecode.create_time,
wecode.del_flag,
wecode.config_id,
wecode.qr_code,
wecusn.business_id,
wecusn.user_name,
wecusn.mobile,
wect.tag_id,
wect.tag_name
from
we_emple_code wecode
left join (
SELECT
wecus.emple_code_id, wecus.business_id, wu.user_name,wu.mobile
FROM
we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON
wu.user_id = wecus.business_id
WHERE
wecus.del_flag = 0
) as wecusn on
wecode.id = wecusn.emple_code_id
left join we_emple_code_tag wect on
wecode.id = wect.emple_code_id
</sql>
<select id="selectWeEmpleCodeList" parameterType="WeEmpleCode" resultMap="WeEmpleCodeResult">
......@@ -81,15 +75,17 @@ left join (
</select>
<select id="selectWeEmpleCodeById" parameterType="Long" resultMap="WeEmpleCodeResult">
<include refid="selectWeEmpleCodeVo"/>
where id = #{id}
<include refid="selectWeEmpleCodeLsit"/>
<where>
wecode.id = #{id}
</where>
</select>
<select id="selectWeEmpleCodeByIds" parameterType="java.util.ArrayList" resultMap="WeEmpleCodeResult">
<include refid="selectWeEmpleCodeVo"/>
<include refid="selectWeEmpleCodeLsit"/>
<where>
<if test="ids != null">
id in
wecode.id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
......
......@@ -9,11 +9,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="tagId" column="tag_id" />
<result property="empleCodeId" column="emple_code_id" />
<result property="delFlag" column="del_flag" />
<result property="tagName" column="name" />
<result property="tagName" column="tag_name" />
</resultMap>
<sql id="selectWeEmpleCodeTagVo">
select id, tag_id, emple_code_id, del_flag from we_emple_code_tag
select id, tag_id, tag_name, emple_code_id, del_flag from we_emple_code_tag
</sql>
<select id="selectWeEmpleCodeTagListById" parameterType="Long" resultMap="WeEmpleCodeTagResult">
......@@ -22,10 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wect.tag_id,
wect.emple_code_id,
wect.del_flag,
wt.`name`
wect.tag_name
FROM
we_emple_code_tag wect
LEFT JOIN we_tag wt ON wt.tag_id=wect.tag_id
WHERE wect.del_flag=0 and wect.emple_code_id=#{empleCodeId}
</select>
......@@ -39,12 +38,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tagId != null">tag_id,</if>
<if test="tagName != null">tag_name,</if>
<if test="empleCodeId != null">emple_code_id,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="tagId != null">#{tagId},</if>
<if test="tagName != null">#{tagName},</if>
<if test="empleCodeId != null">#{empleCodeId},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
......@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update we_emple_code_tag
<trim prefix="SET" suffixOverrides=",">
<if test="tagId != null">tag_id = #{tagId},</if>
<if test="tagName != null">tag_name = #{tagName},</if>
<if test="empleCodeId != null">emple_code_id = #{empleCodeId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
......@@ -72,10 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<insert id="batchInsetWeEmpleCodeTag">
insert into we_emple_code_tag (id,tag_id,emple_code_id,del_flag)
insert into we_emple_code_tag (id,tag_id,tag_name,emple_code_id,del_flag)
values
<foreach collection="weEmpleCodeTags" item="scop" index="index" separator=",">
(#{scop.id},#{scop.tagId},#{scop.empleCodeId},#{scop.delFlag})
(#{scop.id},#{scop.tagId},#{scop.tagName},#{scop.empleCodeId},#{scop.delFlag})
</foreach>
</insert>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!