| @@ -77,6 +77,10 @@ public class WxMerchantBUser implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="name",name="name") | @io.swagger.annotations.ApiModelProperty(value="name",name="name") | ||||
| private String name; | private String name; | ||||
| @io.swagger.annotations.ApiModelProperty(value="删除状态1删除0未删除",name="status") | |||||
| private Integer status; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -146,6 +150,14 @@ public class WxMerchantBUser implements Serializable { | |||||
| this.name = _name; | this.name = _name; | ||||
| } | } | ||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -160,6 +172,7 @@ public class WxMerchantBUser implements Serializable { | |||||
| ,Token_ASC("`token` ASC"),Token_DESC("`token` DESC") | ,Token_ASC("`token` ASC"),Token_DESC("`token` DESC") | ||||
| ,ExpireTime_ASC("`expireTime` ASC"),ExpireTime_DESC("`expireTime` DESC") | ,ExpireTime_ASC("`expireTime` ASC"),ExpireTime_DESC("`expireTime` DESC") | ||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| @@ -84,6 +84,7 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||||
| public boolean hasphone(String phone) { | public boolean hasphone(String phone) { | ||||
| WxMerchantBUser bUser = new WxMerchantBUser(); | WxMerchantBUser bUser = new WxMerchantBUser(); | ||||
| bUser.setPhone(phone); | bUser.setPhone(phone); | ||||
| bUser.setStatus(0); | |||||
| List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser); | List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser); | ||||
| return list.size()>=1?true:false; | return list.size()>=1?true:false; | ||||
| } | } | ||||
| @@ -122,13 +122,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | WxShopMapper.updateByPrimaryKeySelective(wxShop); | ||||
| } | } | ||||
| //删除之前的关联用户 | |||||
| List<WxMerchantBUser> bUsers = wxMerchant.getbUsers(); | List<WxMerchantBUser> bUsers = wxMerchant.getbUsers(); | ||||
| for(WxMerchantBUser user:bUsers){ | |||||
| wxMerchantBUserMapper.deleteByPrimaryKey(user.getId()); | |||||
| } | |||||
| //保存商户关联用户 | //保存商户关联用户 | ||||
| for(WxMerchantBUser user:bUsers){ | for(WxMerchantBUser user:bUsers){ | ||||
| long id = idWorker.nextId(); | long id = idWorker.nextId(); | ||||
| @@ -140,6 +135,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| date = new Date(); | date = new Date(); | ||||
| user.setCreateDate(date); | user.setCreateDate(date); | ||||
| user.setUpdateDate(date); | user.setUpdateDate(date); | ||||
| user.setStatus(0); | |||||
| wxMerchantBUserMapper.insertSelective(user); | wxMerchantBUserMapper.insertSelective(user); | ||||
| } | } | ||||
| @@ -188,25 +184,43 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | WxShopMapper.updateByPrimaryKeySelective(wxShop); | ||||
| } | } | ||||
| //删除之前的关联用户 | |||||
| List<WxMerchantBUser> bUsers = wxMerchant.getbUsers(); | List<WxMerchantBUser> bUsers = wxMerchant.getbUsers(); | ||||
| for(WxMerchantBUser user:bUsers){ | |||||
| wxMerchantBUserMapper.deleteByPrimaryKey(user.getId()); | |||||
| //删除之前的关联用户 | |||||
| WxMerchantBUser bUser = new WxMerchantBUser(); | |||||
| bUser.setMerchantId(wxMerchant.getId()); | |||||
| List<WxMerchantBUser> wxMerchantBUserMapperList = wxMerchantBUserMapper.findList(bUser); | |||||
| for(WxMerchantBUser wxMerchantBUser:wxMerchantBUserMapperList){ | |||||
| wxMerchantBUser.setStatus(1); | |||||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(wxMerchantBUser); | |||||
| } | } | ||||
| //保存商户关联用户 | //保存商户关联用户 | ||||
| for(WxMerchantBUser user:bUsers){ | for(WxMerchantBUser user:bUsers){ | ||||
| long id = idWorker.nextId(); | |||||
| user.setId(id); | |||||
| user.setBUserId(id); | |||||
| user.setMerchantId(wxMerchant.getId()); | |||||
| user.setTenantId(wxMerchant.getTenantId()); | |||||
| user.setAppId(wxAppinfo.getAppId()); | |||||
| date = new Date(); | |||||
| user.setCreateDate(date); | |||||
| user.setUpdateDate(date); | |||||
| wxMerchantBUserMapper.insertSelective(user); | |||||
| if(user.getId()==null){//没有id的新增 | |||||
| long id = idWorker.nextId(); | |||||
| user.setId(id); | |||||
| user.setBUserId(id); | |||||
| user.setMerchantId(wxMerchant.getId()); | |||||
| user.setTenantId(wxMerchant.getTenantId()); | |||||
| user.setAppId(wxAppinfo.getAppId()); | |||||
| date = new Date(); | |||||
| user.setCreateDate(date); | |||||
| user.setUpdateDate(date); | |||||
| user.setStatus(0); | |||||
| wxMerchantBUserMapper.insertSelective(user); | |||||
| }else{//有id的更新 | |||||
| user.setBUserId(user.getId()); | |||||
| user.setMerchantId(wxMerchant.getId()); | |||||
| user.setTenantId(wxMerchant.getTenantId()); | |||||
| user.setAppId(wxAppinfo.getAppId()); | |||||
| date = new Date(); | |||||
| user.setUpdateDate(date); | |||||
| user.setStatus(0); | |||||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(user); | |||||
| } | |||||
| } | } | ||||
| @@ -14,11 +14,11 @@ | |||||
| <result column="token" jdbcType="VARCHAR" property="token" /> | <result column="token" jdbcType="VARCHAR" property="token" /> | ||||
| <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" /> | <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" /> | ||||
| <result column="name" jdbcType="VARCHAR" property="name" /> | <result column="name" jdbcType="VARCHAR" property="name" /> | ||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`b_user_id`,`phone`,`b_user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name` | |||||
| `id`,`tenant_id`,`b_user_id`,`phone`,`b_user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name`,`status` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -81,6 +81,9 @@ | |||||
| <if test=" null != name "> | <if test=" null != name "> | ||||
| and `name` = #{name} | and `name` = #{name} | ||||
| </if> | </if> | ||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||