重构框架
This commit is contained in:
@@ -38,6 +38,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET, "/api/file/**","/**", "/api/captcha", "/")
|
||||
.permitAll()
|
||||
.antMatchers(
|
||||
"/api/think/think-users/loginByOpenId",
|
||||
"/api/login",
|
||||
"/api/register",
|
||||
"/druid/**",
|
||||
|
||||
@@ -35,6 +35,9 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("用户编码")
|
||||
private String userCode;
|
||||
|
||||
@ApiModelProperty("第三方系统的用户ID")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty("账号")
|
||||
private String username;
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.uid != null">
|
||||
AND a.uid = #{param.uid}
|
||||
</if>
|
||||
<if test="param.username != null">
|
||||
AND a.username LIKE CONCAT('%', #{param.username}, '%')
|
||||
</if>
|
||||
|
||||
@@ -44,6 +44,9 @@ public class UserParam extends BaseParam {
|
||||
@ApiModelProperty("用户编码")
|
||||
private String userCode;
|
||||
|
||||
@ApiModelProperty("第三方系统的用户ID")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty("性别(字典)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String sex;
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.service.ThinkCardService;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.entity.ThinkCard;
|
||||
import com.gxwebsoft.think.param.ThinkCardParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.service.ThinkCardBindLogService;
|
||||
import com.gxwebsoft.think.service.ThinkCardService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -30,6 +32,8 @@ import java.util.List;
|
||||
public class ThinkCardController extends BaseController {
|
||||
@Resource
|
||||
private ThinkCardService thinkCardService;
|
||||
@Resource
|
||||
private ThinkCardBindLogService thinkCardBindLogService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
@@ -107,4 +111,36 @@ public class ThinkCardController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("IC卡激活")
|
||||
@PostMapping("/bindCard")
|
||||
public ApiResult<?> bindCard(@RequestBody ThinkCard thinkCard) {
|
||||
System.out.println("thinkCard = " + thinkCard);
|
||||
final User loginUser = getLoginUser();
|
||||
if (ObjectUtil.isEmpty(loginUser)) {
|
||||
return fail("请先登录");
|
||||
}
|
||||
if (StrUtil.isBlank(thinkCard.getCardNum())) {
|
||||
return fail("卡号不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(thinkCard.getUsername())) {
|
||||
return fail("姓名不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(thinkCard.getPhone())) {
|
||||
return fail("电话不能为空");
|
||||
}
|
||||
final ThinkCardParam thinkCardParam = new ThinkCardParam();
|
||||
thinkCardParam.setCardNum(thinkCard.getCardNum());
|
||||
final List<ThinkCard> thinkCards = thinkCardService.listRel(thinkCardParam);
|
||||
if (!CollectionUtils.isEmpty(thinkCards)) {
|
||||
final ThinkCard card = thinkCards.get(0);
|
||||
if (!card.getPhone().equals(getLoginUser().getPhone())) {
|
||||
return fail("非本人卡,无法绑定");
|
||||
}
|
||||
card.setUid(getLoginUser().getUid());
|
||||
thinkCardService.updateById(card);
|
||||
return success("激活成功",null);
|
||||
}
|
||||
return fail("修改失败",null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.service.ThinkIntegralService;
|
||||
import com.gxwebsoft.think.entity.ThinkIntegral;
|
||||
import com.gxwebsoft.think.param.ThinkIntegralParam;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.entity.ThinkIntegral;
|
||||
import com.gxwebsoft.think.entity.ThinkUsers;
|
||||
import com.gxwebsoft.think.param.ThinkIntegralParam;
|
||||
import com.gxwebsoft.think.service.ThinkIntegralService;
|
||||
import com.gxwebsoft.think.service.ThinkUsersService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +33,8 @@ import java.util.List;
|
||||
public class ThinkIntegralController extends BaseController {
|
||||
@Resource
|
||||
private ThinkIntegralService thinkIntegralService;
|
||||
@Resource
|
||||
private ThinkUsersService thinkUsersService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
@@ -45,7 +50,6 @@ public class ThinkIntegralController extends BaseController {
|
||||
return success(thinkIntegralService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('think:thinkIntegral:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ThinkIntegral> get(@PathVariable("id") Integer id) {
|
||||
@@ -56,10 +60,29 @@ public class ThinkIntegralController extends BaseController {
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ThinkIntegral thinkIntegral) {
|
||||
if (thinkIntegralService.save(thinkIntegral)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
final User loginUser = getLoginUser();
|
||||
if (ObjectUtil.isEmpty(loginUser)) {
|
||||
return fail("请先登录");
|
||||
}
|
||||
final ThinkUsers users = thinkUsersService.getById(getLoginUser().getUid());
|
||||
thinkIntegral.setUid(users.getId());
|
||||
thinkIntegral.setUsername(users.getUsername());
|
||||
thinkIntegral.setPhone(users.getPhone());
|
||||
thinkIntegral.setIntegral(new BigDecimal("1"));
|
||||
thinkIntegral.setDateTime(DateUtil.today());
|
||||
thinkIntegral.setDay(String.valueOf(DateUtil.thisDayOfMonth()));
|
||||
thinkIntegral.setCreateTime((int) DateUtil.currentSeconds());
|
||||
|
||||
if (thinkIntegralService.count(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getId,users.getId()).eq(ThinkIntegral::getDateTime, DateUtil.today())) > 0) {
|
||||
return fail("您今天已经签到过了.");
|
||||
}
|
||||
if (thinkIntegralService.save(thinkIntegral)) {
|
||||
// 累计积分
|
||||
users.setIntegral(users.getIntegral().add(thinkIntegral.getIntegral()));
|
||||
thinkUsersService.updateById(users);
|
||||
return success("签到成功");
|
||||
}
|
||||
return fail("签到失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@@ -107,4 +130,16 @@ public class ThinkIntegralController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("本月签到数据")
|
||||
@GetMapping("/getSignData")
|
||||
public ApiResult<?> getSignData(ThinkIntegralParam param) {
|
||||
final User loginUser = getLoginUser();
|
||||
if(loginUser == null){
|
||||
return fail("请先登录");
|
||||
}
|
||||
String message = thinkIntegralService.count(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getPhone,loginUser.getPhone()).eq(ThinkIntegral::getDateTime, DateUtil.today())) > 0 ? "您今天已经签到过了" : "操作成功";
|
||||
final List<ThinkIntegral> list = thinkIntegralService.list(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getPhone,loginUser.getPhone()).like(ThinkIntegral::getDateTime, param.getDateTime()));
|
||||
return success(message,list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||
import com.gxwebsoft.think.param.ThinkOrderParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -45,7 +41,6 @@ public class ThinkOrderController extends BaseController {
|
||||
return success(thinkOrderService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('think:thinkOrder:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ThinkOrder> get(@PathVariable("id") Integer id) {
|
||||
|
||||
@@ -45,7 +45,6 @@ public class ThinkOrderInfoController extends BaseController {
|
||||
return success(thinkOrderInfoService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('think:thinkOrderInfo:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ThinkOrderInfo> get(@PathVariable("id") Integer id) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.service.ThinkUsersAddressService;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.entity.ThinkUsersAddress;
|
||||
import com.gxwebsoft.think.param.ThinkUsersAddressParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.service.ThinkUsersAddressService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -56,6 +56,13 @@ public class ThinkUsersAddressController extends BaseController {
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ThinkUsersAddress thinkUsersAddress) {
|
||||
final User loginUser = getLoginUser();
|
||||
if (ObjectUtil.isEmpty(loginUser)) {
|
||||
return fail("请先登录");
|
||||
}
|
||||
thinkUsersAddress.setUid(getLoginUser().getUid());
|
||||
thinkUsersAddress.setCreateTime((int) DateUtil.currentSeconds());
|
||||
thinkUsersAddress.setUpdateTime((int) DateUtil.currentSeconds());
|
||||
if (thinkUsersAddressService.save(thinkUsersAddress)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.service.ThinkUsersService;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.think.entity.ThinkUsers;
|
||||
import com.gxwebsoft.think.param.ThinkUsersParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.service.ThinkUsersService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -45,7 +47,6 @@ public class ThinkUsersController extends BaseController {
|
||||
return success(thinkUsersService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('think:thinkUsers:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ThinkUsers> get(@PathVariable("id") Integer id) {
|
||||
@@ -107,4 +108,51 @@ public class ThinkUsersController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("openid无感登录")
|
||||
@PostMapping("/loginByOpenId")
|
||||
public ApiResult<?> loginByOpenId(@RequestBody ThinkUsers users) {
|
||||
String AppId = "wxd38cc38c54fa7370";
|
||||
String AppSecret = "f1f9dcb62012d5e32e52c5a0b418df22";
|
||||
|
||||
// 请求微信接口获取openid
|
||||
String apiUrl = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("appid",AppId);
|
||||
map.put("secret",AppSecret);
|
||||
map.put("js_code",users.getCode());
|
||||
map.put("grant_type","authorization_code");
|
||||
final String response = HttpUtil.get(apiUrl,map);
|
||||
final JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
String openid = jsonObject.getString("openid");
|
||||
String sessionKey = jsonObject.getString("session_key");
|
||||
String unionid = jsonObject.getString("unionid");
|
||||
System.out.println("openid = " + openid);
|
||||
System.out.println("unionid = " + unionid);
|
||||
System.out.println("sessionKey = " + sessionKey);
|
||||
|
||||
if (StrUtil.isNotBlank(openid)) {
|
||||
ThinkUsers thinkUsers = thinkUsersService.getOne(new LambdaQueryWrapper<ThinkUsers>().eq(ThinkUsers::getOpenId, openid).last("limit 1"));
|
||||
if(ObjectUtil.isNotEmpty(thinkUsers)){
|
||||
return success("登录成功", thinkUsers);
|
||||
}else {
|
||||
final ThinkUsers add = new ThinkUsers();
|
||||
add.setOpenId(openid);
|
||||
add.setSessionKey(sessionKey);
|
||||
add.setUsername("微信用户");
|
||||
add.setAvatarUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132");
|
||||
add.setGender(0);
|
||||
add.setCountry("");
|
||||
add.setProvince("");
|
||||
add.setCity("");
|
||||
add.setPhone(null);
|
||||
add.setCreateTime((int) (System.currentTimeMillis()/1000));
|
||||
if(thinkUsersService.save(add)){
|
||||
return success("注册成功", add);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fail("openId获取失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.service.ThinkUsersEmergencyService;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.think.entity.ThinkUsersEmergency;
|
||||
import com.gxwebsoft.think.param.ThinkUsersEmergencyParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.think.service.ThinkUsersEmergencyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -56,6 +54,12 @@ public class ThinkUsersEmergencyController extends BaseController {
|
||||
@ApiOperation("添加紧急联系人表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ThinkUsersEmergency thinkUsersEmergency) {
|
||||
if (ObjectUtil.isEmpty(getLoginUser())) {
|
||||
return fail("请先登录");
|
||||
}
|
||||
System.out.println("getLoginUser() = " + getLoginUser());
|
||||
thinkUsersEmergency.setUid(getLoginUser().getUid());
|
||||
thinkUsersEmergency.setCreateTime((int) (System.currentTimeMillis()/1000));
|
||||
if (thinkUsersEmergencyService.save(thinkUsersEmergency)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
@@ -65,6 +69,7 @@ public class ThinkUsersEmergencyController extends BaseController {
|
||||
@ApiOperation("修改紧急联系人表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ThinkUsersEmergency thinkUsersEmergency) {
|
||||
thinkUsersEmergency.setUpdateTime((int) (System.currentTimeMillis()/1000));
|
||||
if (thinkUsersEmergencyService.updateById(thinkUsersEmergency)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -141,4 +142,8 @@ public class ThinkOrder implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String dateTime;
|
||||
|
||||
@ApiModelProperty(value = "预定信息")
|
||||
@TableField(exist = false)
|
||||
private List<ThinkOrderInfo> thinkOrderInfos;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gxwebsoft.think.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -68,4 +69,8 @@ public class ThinkUsers implements Serializable {
|
||||
@ApiModelProperty(value = "是否管理员:1是;2否")
|
||||
private Integer isAdmin;
|
||||
|
||||
@ApiModelProperty(value = "微信登录凭证")
|
||||
@TableField(exist = false)
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.gxwebsoft.think.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.think.entity.ThinkOrderInfo;
|
||||
import com.gxwebsoft.think.mapper.ThinkOrderMapper;
|
||||
import com.gxwebsoft.think.service.ThinkOrderInfoService;
|
||||
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||
import com.gxwebsoft.think.param.ThinkOrderParam;
|
||||
@@ -9,6 +13,7 @@ import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -19,12 +24,17 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOrder> implements ThinkOrderService {
|
||||
@Resource
|
||||
private ThinkOrderInfoService thinkOrderInfoService;
|
||||
|
||||
@Override
|
||||
public PageResult<ThinkOrder> pageRel(ThinkOrderParam param) {
|
||||
PageParam<ThinkOrder, ThinkOrderParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<ThinkOrder> list = baseMapper.selectPageRel(page, param);
|
||||
list.forEach(d -> {
|
||||
d.setThinkOrderInfos(thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, d.getId())));
|
||||
});
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@@ -41,7 +51,11 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
||||
public ThinkOrder getByIdRel(Integer id) {
|
||||
ThinkOrderParam param = new ThinkOrderParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
final ThinkOrder thinkOrder = param.getOne(baseMapper.selectListRel(param));
|
||||
if (ObjectUtil.isNotEmpty(thinkOrder)) {
|
||||
thinkOrder.setThinkOrderInfos(thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, thinkOrder.getId())));
|
||||
}
|
||||
return thinkOrder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user