Commit 655c5f95 by sunxiwang

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

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