| | |
| | | import com.matrix.system.hive.dao.SysVipLabelDao; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | @Autowired |
| | | private SysVipLabelDao sysVipLabelDao; |
| | | |
| | | @ApiOperation(value = "获取客户标签列表", notes = "获取客户标签列表") |
| | | @GetMapping(value = "/findLabelByVipId/{vipId}") |
| | | public AjaxResult findLabelByVipId(@PathVariable("vipId") Long vipId) { |
| | | return null; |
| | | @ApiOperation(value = "获取标签列表", notes = "获取标签列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = SysVipLabel.class) |
| | | }) |
| | | @PostMapping(value = "/findLabelList") |
| | | public AjaxResult findLabelByVipId(@RequestBody LabelDto labelDto) { |
| | | SysVipLabel sysVipLabel = new SysVipLabel(); |
| | | sysVipLabel.setCompanyId(getMe().getCompanyId()); |
| | | sysVipLabel.setIsAll(1); |
| | | sysVipLabel.setLabel(labelDto.getLabel()); |
| | | List<SysVipLabel> zbLabel = sysVipLabelDao.selectByModel(sysVipLabel); |
| | | |
| | | sysVipLabel = new SysVipLabel(); |
| | | sysVipLabel.setUserId(getMe().getSuId()); |
| | | sysVipLabel.setLabel(labelDto.getLabel()); |
| | | List<SysVipLabel> userLabel = sysVipLabelDao.selectByModel(sysVipLabel); |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | ajaxResult.putInMap("allLabel", zbLabel); |
| | | ajaxResult.putInMap("myLabel", userLabel); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | |
| | |
| | | @ApiOperation(value = "删除标签", notes = "删除标签") |
| | | @GetMapping(value = "/delById/{id}") |
| | | public AjaxResult delById(@PathVariable("id") Long id) { |
| | | return null; |
| | | int i = sysVipLabelDao.deleteById(id); |
| | | if (i > 0) { |
| | | return AjaxResult.buildSuccessInstance("删除成功"); |
| | | } |
| | | return AjaxResult.buildFailInstance("删除失败"); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | if ("dev".equals(evn)) { |
| | | SysUsers sysUsers = sysUsersDao.selectById(1074L); |
| | | SysUsers sysUsers = sysUsersDao.selectById(1012L); |
| | | request.getSession().setAttribute(MatrixConstance.LOGIN_KEY, sysUsers); |
| | | return true; |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 会员ID |
| | | */ |
| | | private Long vipId; |
| | | |
| | | /** |
| | | * 标签内容 |
| | | */ |
| | | private String label; |
| | |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getVipId() { |
| | | return vipId; |
| | | } |
| | | |
| | | public void setVipId(Long vipId) { |
| | | this.vipId = vipId; |
| | | } |
| | | |
| | | public String getLabel() { |
| | |
| | | int i=sysVipInfoDao.insert(vipInfo); |
| | | |
| | | if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) { |
| | | batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId()); |
| | | // batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId()); |
| | | } |
| | | |
| | | //创建用户默认储值卡 |
| | |
| | | int i = sysVipInfoDao.update(vipInfo); |
| | | |
| | | if (CollectionUtils.isNotEmpty(modifyVipDto.getLabels())) { |
| | | sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId()); |
| | | |
| | | batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId()); |
| | | // sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId()); |
| | | // batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId()); |
| | | } |
| | | return i; |
| | | } |
| | |
| | | sysVipLabel.setCreateTime(new Date()); |
| | | sysVipLabel.setCreateBy(suName); |
| | | sysVipLabel.setLabel(iterator.next()); |
| | | sysVipLabel.setVipId(id); |
| | | sysVipLabelDao.insert(sysVipLabel); |
| | | } |
| | | } |
| | |
| | | create_time, |
| | | create_by, |
| | | id, |
| | | vip_id, |
| | | label, |
| | | shop_id, |
| | | company_id, |
| | |
| | | #{createTime}, |
| | | #{createBy}, |
| | | #{id}, |
| | | #{vipId}, |
| | | #{label}, |
| | | #{shopId}, |
| | | #{companyId}, |
| | |
| | | </select> |
| | | |
| | | <select id="selectByModel" resultType="com.matrix.system.hive.bean.SysVipLabel"> |
| | | select * from sys_vip_label |
| | | select |
| | | create_time createTime, |
| | | create_by createBy, |
| | | id, |
| | | label, |
| | | shop_id shopId, |
| | | company_id companyId, |
| | | is_all isAll, |
| | | user_id userId, |
| | | color |
| | | from sys_vip_label |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | <if test="record.label!=null and record.label!=''"> |
| | | and label=#{record.label} |
| | | and label like CONCAT('%', CONCAT(#{record.label},'%')) |
| | | </if> |
| | | <if test="record.vipId!=null"> |
| | | and vip_id=#{record.vipId} |
| | | <if test="record.isAll!=null and record.isAll!=0"> |
| | | and is_all=#{record.isAll} |
| | | </if> |
| | | <if test="record.userId!=null and record.userId!=''"> |
| | | and user_id=#{record.userId} |
| | | </if> |
| | | <if test="record.companyId!=null and record.companyId!=''"> |
| | | and company_id=#{record.companyId} |
| | | </if> |
| | | </if> |
| | | </select> |