Commit ee06d4a8 by duanhq

资源绑定bug修改,角色模糊查询修改 by duanht 2019/3/18

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18614 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent e8de154d
...@@ -30,4 +30,7 @@ public interface SysUserServicesMapper { ...@@ -30,4 +30,7 @@ public interface SysUserServicesMapper {
int updateByPrimaryKey(SysUserServices record); int updateByPrimaryKey(SysUserServices record);
int deleteByUserIdAndServiceId(@Param(value = "userId") int userId, @Param(value = "item") String item); int deleteByUserIdAndServiceId(@Param(value = "userId") int userId, @Param(value = "item") String item);
List<SysUserServices> selectByUserId(@Param(value = "userId")Integer userId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,11 @@ public class SysUserServices { ...@@ -15,6 +15,11 @@ public class SysUserServices {
*/ */
private Integer installTime; private Integer installTime;
/**
* 商户资源匹配状态(sys_user_status_unbound_service:未绑定服务商;sys_user_status_unbound_mechanic:已绑定服务商未绑定技工;sys_user_status_bound:两者都绑定)
*/
private String merchantStatus;
public Integer getId() { public Integer getId() {
return id; return id;
} }
...@@ -46,4 +51,12 @@ public class SysUserServices { ...@@ -46,4 +51,12 @@ public class SysUserServices {
public void setInstallTime(Integer installTime) { public void setInstallTime(Integer installTime) {
this.installTime = installTime; this.installTime = installTime;
} }
public String getMerchantStatus() {
return merchantStatus;
}
public void setMerchantStatus(String merchantStatus) {
this.merchantStatus = merchantStatus;
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -353,6 +353,76 @@ public class SysUserServicesExample { ...@@ -353,6 +353,76 @@ public class SysUserServicesExample {
addCriterion("install_time not between", value1, value2, "installTime"); addCriterion("install_time not between", value1, value2, "installTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMerchantStatusIsNull() {
addCriterion("merchant_status is null");
return (Criteria) this;
}
public Criteria andMerchantStatusIsNotNull() {
addCriterion("merchant_status is not null");
return (Criteria) this;
}
public Criteria andMerchantStatusEqualTo(String value) {
addCriterion("merchant_status =", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusNotEqualTo(String value) {
addCriterion("merchant_status <>", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusGreaterThan(String value) {
addCriterion("merchant_status >", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusGreaterThanOrEqualTo(String value) {
addCriterion("merchant_status >=", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusLessThan(String value) {
addCriterion("merchant_status <", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusLessThanOrEqualTo(String value) {
addCriterion("merchant_status <=", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusLike(String value) {
addCriterion("merchant_status like", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusNotLike(String value) {
addCriterion("merchant_status not like", value, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusIn(List<String> values) {
addCriterion("merchant_status in", values, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusNotIn(List<String> values) {
addCriterion("merchant_status not in", values, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusBetween(String value1, String value2) {
addCriterion("merchant_status between", value1, value2, "merchantStatus");
return (Criteria) this;
}
public Criteria andMerchantStatusNotBetween(String value1, String value2) {
addCriterion("merchant_status not between", value1, value2, "merchantStatus");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -121,7 +121,7 @@ public interface SysUserService { ...@@ -121,7 +121,7 @@ public interface SysUserService {
* @return SysUser * @return SysUser
* @author duanht * @author duanht
* @Title: getUserById * @Title: getUserById
* @Description: TODO 绑定服务商或技工 * @Description: TODO 绑定服务商或技工(bindType 1:绑定服务商,2:绑定技工)
*/ */
int bindingService(SysResourceMatching sysResourceMatching , Integer bindType); int bindingService(SysResourceMatching sysResourceMatching , Integer bindType);
......
...@@ -48,7 +48,7 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -48,7 +48,7 @@ public class SysRoleServiceImpl implements SysRoleService {
} }
if (StringUtils.isNotEmpty(roleQueryVo.getName())) { if (StringUtils.isNotEmpty(roleQueryVo.getName())) {
criteria.andNameLike(roleQueryVo.getName()); criteria.andNameLike("%"+roleQueryVo.getName()+"%");
} }
if (StringUtils.isNotEmpty(roleQueryVo.getsTime()) && StringUtils.isNotEmpty(roleQueryVo.geteTime())) { if (StringUtils.isNotEmpty(roleQueryVo.getsTime()) && StringUtils.isNotEmpty(roleQueryVo.geteTime())) {
...@@ -62,7 +62,7 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -62,7 +62,7 @@ public class SysRoleServiceImpl implements SysRoleService {
} }
if (StringUtils.isNotEmpty(roleQueryVo.getPermissionCharacter())) { if (StringUtils.isNotEmpty(roleQueryVo.getPermissionCharacter())) {
criteria.andPermissionCharacterLike(roleQueryVo.getPermissionCharacter()); criteria.andPermissionCharacterLike("%"+roleQueryVo.getPermissionCharacter()+"%");
} }
sysRoleExample.setOrderByClause("sort"); sysRoleExample.setOrderByClause("sort");
......
package com.glsx.usercenter.service.impl; package com.glsx.usercenter.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import com.glsx.usercenter.pojo.user.*;
import com.glsx.usercenter.service.ISysOrganizationService; import com.glsx.usercenter.service.ISysOrganizationService;
import com.glsx.usercenter.utils.ShiroUtil; import com.glsx.usercenter.utils.ShiroUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -30,18 +33,6 @@ import com.glsx.usercenter.mapper.SysUserOrgMapper; ...@@ -30,18 +33,6 @@ import com.glsx.usercenter.mapper.SysUserOrgMapper;
import com.glsx.usercenter.mapper.SysUserRoleMapper; import com.glsx.usercenter.mapper.SysUserRoleMapper;
import com.glsx.usercenter.mapper.SysUserServicesMapper; import com.glsx.usercenter.mapper.SysUserServicesMapper;
import com.glsx.usercenter.pojo.menu.SysOrganization; import com.glsx.usercenter.pojo.menu.SysOrganization;
import com.glsx.usercenter.pojo.user.SysManager;
import com.glsx.usercenter.pojo.user.SysMechanic;
import com.glsx.usercenter.pojo.user.SysMerchant;
import com.glsx.usercenter.pojo.user.SysResourceMatching;
import com.glsx.usercenter.pojo.user.SysResourceMatchingExample;
import com.glsx.usercenter.pojo.user.SysUser;
import com.glsx.usercenter.pojo.user.SysUserExample;
import com.glsx.usercenter.pojo.user.SysUserImage;
import com.glsx.usercenter.pojo.user.SysUserImageExample;
import com.glsx.usercenter.pojo.user.SysUserOrg;
import com.glsx.usercenter.pojo.user.SysUserRole;
import com.glsx.usercenter.pojo.user.SysUserServices;
import com.glsx.usercenter.pojo.vo.UserQueryVo; import com.glsx.usercenter.pojo.vo.UserQueryVo;
import com.glsx.usercenter.service.IAreaService; import com.glsx.usercenter.service.IAreaService;
import com.glsx.usercenter.service.SysUserService; import com.glsx.usercenter.service.SysUserService;
...@@ -461,19 +452,45 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -461,19 +452,45 @@ public class SysUserServiceImpl implements SysUserService {
private void updateServiceItem(Integer userId, SysUser sysUser) { private void updateServiceItem(Integer userId, SysUser sysUser) {
logger.info(sysUser.getName() + "开始更新服务项"); logger.info(sysUser.getName() + "开始更新服务项");
//如果是更新需要先删除原有的连接数据
//传入的服务项
List<SysUserServices> newSysUserServices = new ArrayList<>();
for (int i = 0; i < sysUser.getServiceKeyList().size(); i++) { for (int i = 0; i < sysUser.getServiceKeyList().size(); i++) {
if (userId == null) {
//根据user_id和服务项删除数据
sysUserServicesMapper.deleteByUserIdAndServiceId(sysUser.getUserId(), sysUser.getServiceKeyList().get(i));
}
SysUserServices userServices = new SysUserServices(); SysUserServices userServices = new SysUserServices();
userServices.setUserId(sysUser.getUserId()); userServices.setUserId(sysUser.getUserId());
userServices.setServiceKey(sysUser.getServiceKeyList().get(i)); userServices.setServiceKey(sysUser.getServiceKeyList().get(i));
newSysUserServices.add(userServices);
}
//原先的服务项
List<SysUserServices> originSysUserServices = new ArrayList<>();
originSysUserServices = sysUserServicesMapper.selectByUserId(sysUser.getUserId());
//去重后区分出需要新增和删除的服务项
Set<SysUserServices> unionSysUserServices = new HashSet<>();
//编辑服务项
if (userId == null) {
unionSysUserServices.addAll(newSysUserServices);
unionSysUserServices.addAll(originSysUserServices);
unionSysUserServices.removeAll(newSysUserServices);
//根据user_id和服务项删除数据
for (SysUserServices delList : unionSysUserServices) {
sysUserServicesMapper.deleteByUserIdAndServiceId(delList.getUserId(), delList.getServiceKey());
}
}
unionSysUserServices.addAll(newSysUserServices);
unionSysUserServices.removeAll(originSysUserServices);
List<SysUserServices> addList = new ArrayList<>(unionSysUserServices);
for (int i = 0; i < addList.size(); i++) {
if (!sysUser.getInstallTimeList().isEmpty()) { if (!sysUser.getInstallTimeList().isEmpty()) {
userServices.setInstallTime(sysUser.getInstallTimeList().get(i)); addList.get(i).setInstallTime(sysUser.getInstallTimeList().get(i));
}
//商户绑定状态默认为未绑定服务商
if (sysUser.getUserType() == Constants.USER_TYPE_MERCHANT) {
addList.get(i).setMerchantStatus("sys_user_status_unbound_service");
} }
sysUserServicesMapper.insert(userServices); sysUserServicesMapper.insertSelective(addList.get(i));
} }
logger.info("服务项更新成功"); logger.info("服务项更新成功");
} }
...@@ -482,23 +499,45 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -482,23 +499,45 @@ public class SysUserServiceImpl implements SysUserService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int bindingService(SysResourceMatching sysResourceMatching, Integer bindType) { public int bindingService(SysResourceMatching sysResourceMatching, Integer bindType) {
List<SysResourceMatching> sysResourceMatchingList = new ArrayList<>();
//绑定前要删除之前的数据 //绑定前要删除之前的数据
SysResourceMatchingExample sysResourceMatchingExample = new SysResourceMatchingExample(); SysResourceMatchingExample sysResourceMatchingExample = new SysResourceMatchingExample();
SysResourceMatchingExample.Criteria criteria = sysResourceMatchingExample.createCriteria(); SysResourceMatchingExample.Criteria criteria = sysResourceMatchingExample.createCriteria();
criteria.andMerchantIdEqualTo(sysResourceMatching.getMerchantId()); criteria.andMerchantIdEqualTo(sysResourceMatching.getMerchantId());
criteria.andServiceKeyEqualTo(sysResourceMatching.getServiceKey()); criteria.andServiceKeyEqualTo(sysResourceMatching.getServiceKey());
sysResourceMatchingList = sysResourceMatchingMapper.selectByExample(sysResourceMatchingExample);
//修改绑定服务商时,需要把之前的数据删除
if (sysResourceMatchingList.isEmpty() ||
(sysResourceMatchingList.size() == 1 && bindType == 1) ||
(sysResourceMatchingList.size() == 2 && bindType == 1)) {
sysResourceMatchingMapper.deleteByExample(sysResourceMatchingExample); sysResourceMatchingMapper.deleteByExample(sysResourceMatchingExample);
}
//只修改绑定技工则只删除绑定技工
if (sysResourceMatchingList.size() == 2 && bindType == 2) {
for(SysResourceMatching resourceMatching : sysResourceMatchingList){
SysUser sysUser = sysUserMapper.selectByPrimaryKey(resourceMatching.getUserId());
if(sysUser.getUserType() == Constants.USER_TYPE_MECHANIC){
criteria.andUserIdEqualTo(sysUser.getId());
sysResourceMatchingMapper.deleteByExample(sysResourceMatchingExample);
}
}
}
//修改门店状态 //修改门店状态
SysMerchant sysMerchant = new SysMerchant(); SysUserServices sysUserService = new SysUserServices();
sysMerchant.setId(sysResourceMatching.getMerchantId()); SysUserServicesExample sysUserServicesExample = new SysUserServicesExample();
SysUserServicesExample.Criteria criteria1 = sysUserServicesExample.createCriteria();
criteria1.andUserIdEqualTo(sysResourceMatching.getMerchantId());
criteria1.andServiceKeyEqualTo(sysResourceMatching.getServiceKey());
//(1:绑定服务商 2:绑定技工) //(1:绑定服务商 2:绑定技工)
if (bindType == 1) { if (bindType == 1) {
sysMerchant.setMerchantStatus("sys_user_status_unbound_mechanic"); sysUserService.setMerchantStatus("sys_user_status_unbound_mechanic");
} else { } else {
sysMerchant.setMerchantStatus("sys_user_status_bound"); sysUserService.setMerchantStatus("sys_user_status_bound");
} }
sysUserMapper.updateSysMerchant(sysMerchant); sysUserServicesMapper.updateByExampleSelective(sysUserService, sysUserServicesExample);
return sysResourceMatchingMapper.insert(sysResourceMatching); return sysResourceMatchingMapper.insert(sysResourceMatching);
} }
...@@ -672,7 +711,7 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -672,7 +711,7 @@ public class SysUserServiceImpl implements SysUserService {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(new SysUserServiceImpl().encryptPassword("glsx8888")); System.out.println(new SysUserServiceImpl().encryptPassword("123456"));
} }
@Override @Override
......
...@@ -514,9 +514,6 @@ ...@@ -514,9 +514,6 @@
<if test="serviceType != null"> <if test="serviceType != null">
service_type = #{serviceType,jdbcType=INTEGER}, service_type = #{serviceType,jdbcType=INTEGER},
</if> </if>
<if test="merchantStatus != null">
merchant_status = #{merchantStatus,jdbcType=VARCHAR},
</if>
</set> </set>
where user_id = #{id,jdbcType=INTEGER} where user_id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -667,7 +664,7 @@ ...@@ -667,7 +664,7 @@
sm.address address, sm.address address,
GROUP_CONCAT(sdd.data_value SEPARATOR '/') serviceItems, GROUP_CONCAT(sdd.data_value SEPARATOR '/') serviceItems,
GROUP_CONCAT(sdd.data_key ) serviceKey, GROUP_CONCAT(sdd.data_key ) serviceKey,
sm.merchant_status merchantStatus, sms.merchant_status merchantStatus,
u.group_id groupId u.group_id groupId
<choose> <choose>
<when test="userId != 0 and userId!=''"> <when test="userId != 0 and userId!=''">
...@@ -757,7 +754,7 @@ ...@@ -757,7 +754,7 @@
sm.address address, sm.address address,
sdd.data_key serviceKey, sdd.data_key serviceKey,
sdd.data_value serviceItems, sdd.data_value serviceItems,
sm.merchant_status merchantStatus, sms.merchant_status merchantStatus,
u.group_id groupId, u.group_id groupId,
srm.user_id userId srm.user_id userId
<choose> <choose>
...@@ -825,10 +822,10 @@ ...@@ -825,10 +822,10 @@
and u.user_status IN ('sys_user_status_normal') and u.user_status IN ('sys_user_status_normal')
<choose> <choose>
<when test="userStatus != null and userStatus!=''"> <when test="userStatus != null and userStatus!=''">
and sm.merchant_status = #{userStatus,jdbcType=VARCHAR} and sms.merchant_status = #{userStatus,jdbcType=VARCHAR}
</when> </when>
<otherwise> <otherwise>
and sm.merchant_status IN and sms.merchant_status IN
('sys_user_status_unbound_service','sys_user_status_unbound_mechanic','sys_user_status_bound') ('sys_user_status_unbound_service','sys_user_status_unbound_mechanic','sys_user_status_bound')
</otherwise> </otherwise>
</choose> </choose>
...@@ -838,10 +835,10 @@ ...@@ -838,10 +835,10 @@
and u.user_status IN ('sys_user_status_normal') and u.user_status IN ('sys_user_status_normal')
<choose> <choose>
<when test="userStatus != null and userStatus!=''"> <when test="userStatus != null and userStatus!=''">
and sm.merchant_status = #{userStatus,jdbcType=VARCHAR} and sms.merchant_status = #{userStatus,jdbcType=VARCHAR}
</when> </when>
<otherwise> <otherwise>
and sm.merchant_status IN ('sys_user_status_unbound_mechanic','sys_user_status_bound') and sms.merchant_status IN ('sys_user_status_unbound_mechanic','sys_user_status_bound')
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
...@@ -941,6 +938,7 @@ ...@@ -941,6 +938,7 @@
u.user_status userStatus, u.user_status userStatus,
u. NAME, u. NAME,
so.name orgName, so.name orgName,
u.org_id orgId,
phone_number phoneNumber, phone_number phoneNumber,
sm.district district, sm.district district,
sm.address address, sm.address address,
...@@ -1103,7 +1101,7 @@ ...@@ -1103,7 +1101,7 @@
su.id su.id
FROM sys_resource_matching srm LEFT JOIN sys_service_mechanic ssm ON srm.user_id = ssm.service_id FROM sys_resource_matching srm LEFT JOIN sys_service_mechanic ssm ON srm.user_id = ssm.service_id
LEFT JOIN sys_user su ON ssm.mechanic_id = su.id LEFT JOIN sys_user_services sus ON su.id = sus.user_id LEFT JOIN sys_user su ON ssm.mechanic_id = su.id LEFT JOIN sys_user_services sus ON su.id = sus.user_id
WHERE srm.merchant_id = #{merchantId,jdbcType=INTEGER} AND sus.service_key = #{serviceKey,jdbcType=VARCHAR} WHERE srm.merchant_id = #{merchantId,jdbcType=INTEGER}
AND su.user_status = 'sys_user_status_normal' AND su.user_status = 'sys_user_status_normal'
AND su.user_type = 3 AND su.user_type = 3
<if test="orgId != null"> <if test="orgId != null">
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<result column="user_id" jdbcType="INTEGER" property="userId" /> <result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="service_key" jdbcType="VARCHAR" property="serviceKey" /> <result column="service_key" jdbcType="VARCHAR" property="serviceKey" />
<result column="install_time" jdbcType="INTEGER" property="installTime" /> <result column="install_time" jdbcType="INTEGER" property="installTime" />
<result column="merchant_status" jdbcType="VARCHAR" property="merchantStatus" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -66,7 +67,7 @@ ...@@ -66,7 +67,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, service_key, install_time id, user_id, service_key, install_time, merchant_status
</sql> </sql>
<select id="selectByExample" parameterType="com.glsx.usercenter.pojo.user.SysUserServicesExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.glsx.usercenter.pojo.user.SysUserServicesExample" resultMap="BaseResultMap">
select select
...@@ -103,10 +104,10 @@ ...@@ -103,10 +104,10 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
insert into sys_user_services (user_id, service_key, install_time insert into sys_user_services (user_id, service_key, install_time,
) merchant_status)
values (#{userId,jdbcType=INTEGER}, #{serviceKey,jdbcType=VARCHAR}, #{installTime,jdbcType=INTEGER} values (#{userId,jdbcType=INTEGER}, #{serviceKey,jdbcType=VARCHAR}, #{installTime,jdbcType=INTEGER},
) #{merchantStatus,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.glsx.usercenter.pojo.user.SysUserServices"> <insert id="insertSelective" parameterType="com.glsx.usercenter.pojo.user.SysUserServices">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
...@@ -123,6 +124,9 @@ ...@@ -123,6 +124,9 @@
<if test="installTime != null"> <if test="installTime != null">
install_time, install_time,
</if> </if>
<if test="merchantStatus != null">
merchant_status,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null"> <if test="userId != null">
...@@ -134,6 +138,9 @@ ...@@ -134,6 +138,9 @@
<if test="installTime != null"> <if test="installTime != null">
#{installTime,jdbcType=INTEGER}, #{installTime,jdbcType=INTEGER},
</if> </if>
<if test="merchantStatus != null">
#{merchantStatus,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.glsx.usercenter.pojo.user.SysUserServicesExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.glsx.usercenter.pojo.user.SysUserServicesExample" resultType="java.lang.Long">
...@@ -157,6 +164,9 @@ ...@@ -157,6 +164,9 @@
<if test="record.installTime != null"> <if test="record.installTime != null">
install_time = #{record.installTime,jdbcType=INTEGER}, install_time = #{record.installTime,jdbcType=INTEGER},
</if> </if>
<if test="record.merchantStatus != null">
merchant_status = #{record.merchantStatus,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -167,7 +177,8 @@ ...@@ -167,7 +177,8 @@
set id = #{record.id,jdbcType=INTEGER}, set id = #{record.id,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER}, user_id = #{record.userId,jdbcType=INTEGER},
service_key = #{record.serviceKey,jdbcType=VARCHAR}, service_key = #{record.serviceKey,jdbcType=VARCHAR},
install_time = #{record.installTime,jdbcType=INTEGER} install_time = #{record.installTime,jdbcType=INTEGER},
merchant_status = #{record.merchantStatus,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -184,6 +195,9 @@ ...@@ -184,6 +195,9 @@
<if test="installTime != null"> <if test="installTime != null">
install_time = #{installTime,jdbcType=INTEGER}, install_time = #{installTime,jdbcType=INTEGER},
</if> </if>
<if test="merchantStatus != null">
merchant_status = #{merchantStatus,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -191,7 +205,8 @@ ...@@ -191,7 +205,8 @@
update sys_user_services update sys_user_services
set user_id = #{userId,jdbcType=INTEGER}, set user_id = #{userId,jdbcType=INTEGER},
service_key = #{serviceKey,jdbcType=VARCHAR}, service_key = #{serviceKey,jdbcType=VARCHAR},
install_time = #{installTime,jdbcType=INTEGER} install_time = #{installTime,jdbcType=INTEGER},
merchant_status = #{merchantStatus,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -200,4 +215,13 @@ ...@@ -200,4 +215,13 @@
WHERE user_id = #{userId,jdbcType=INTEGER} AND service_key = #{item,jdbcType=VARCHAR} WHERE user_id = #{userId,jdbcType=INTEGER} AND service_key = #{item,jdbcType=VARCHAR}
</delete> </delete>
<select id="selectByUserId" resultType="com.glsx.usercenter.pojo.user.SysUserServices">
SELECT
id,
user_id userId,
service_key serviceKey
FROM sys_user_services
WHERE user_id = #{userId,jdbcType=INTEGER}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -171,7 +171,6 @@ CREATE TABLE `sys_merchant` ( ...@@ -171,7 +171,6 @@ CREATE TABLE `sys_merchant` (
`district` varchar(100) DEFAULT NULL COMMENT '门店所在省市区', `district` varchar(100) DEFAULT NULL COMMENT '门店所在省市区',
`address` varchar(255) DEFAULT NULL COMMENT '门店详细地址', `address` varchar(255) DEFAULT NULL COMMENT '门店详细地址',
`service_type` tinyint(4) DEFAULT NULL COMMENT '服务类型(1:上门,2:驻店)', `service_type` tinyint(4) DEFAULT NULL COMMENT '服务类型(1:上门,2:驻店)',
`merchant_status` varchar(64) NOT NULL DEFAULT 'sys_user_status_unbound_service' COMMENT '商户资源匹配状态(sys_user_status_unbound_service:未绑定服务商;sys_user_status_unbound_mechanic:已绑定服务商未绑定技工;sys_user_status_bound:两者都绑定)',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_shop_name` (`shop_name`(191)) USING BTREE COMMENT '门店名称索引', KEY `idx_shop_name` (`shop_name`(191)) USING BTREE COMMENT '门店名称索引',
KEY `idx_user_id` (`user_id`) USING BTREE COMMENT '用户id索引' KEY `idx_user_id` (`user_id`) USING BTREE COMMENT '用户id索引'
...@@ -456,5 +455,6 @@ CREATE TABLE `sys_user_services` ( ...@@ -456,5 +455,6 @@ CREATE TABLE `sys_user_services` (
`user_id` int(11) NOT NULL COMMENT '用户id', `user_id` int(11) NOT NULL COMMENT '用户id',
`service_key` varchar(64) NOT NULL COMMENT '服务项key', `service_key` varchar(64) NOT NULL COMMENT '服务项key',
`install_time` int(11) DEFAULT NULL COMMENT '安装时间(适用于技工)', `install_time` int(11) DEFAULT NULL COMMENT '安装时间(适用于技工)',
`merchant_status` varchar(64) NOT NULL DEFAULT 'sys_user_status_unbound_service' COMMENT '商户资源匹配状态(sys_user_status_unbound_service:未绑定服务商;sys_user_status_unbound_mechanic:已绑定服务商未绑定技工;sys_user_status_bound:两者都绑定)',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8mb4 COMMENT='用户服务项表'; ) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8mb4 COMMENT='用户服务项表';
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!