收藏模块+统计维度

This commit is contained in:
guojunjie 2025-01-22 19:21:50 +08:00
parent 0c5ac83574
commit fab091e614
19 changed files with 330 additions and 190 deletions

View File

@ -94,6 +94,7 @@ public class CpLabelController extends BaseController {
@ApiOperation(value = "查询单个标签")
@RequestMapping(value = "{id}", method = {RequestMethod.GET})
@ApiImplicitParam(name = "id", value = "标签ID", required = true, paramType = "path")
@Unsecured
public Result one(@PathVariable final Integer id) {
try {
CpLabel entity = entityService.getLabelById(id);

View File

@ -59,7 +59,7 @@ public class AcLogController extends BaseController {
private PaConsumptionService paConsumptionService;
@SysLog(action = "statistics:basicInformation", value = "")
@ApiOperation(value = "统计基础信息:用户数,今天新增用户数,首页总浏览数,今日浏览数")
@ApiOperation(value = "统计基础信息:用户数,今天新增用户数,首页总浏览数,今日浏览数,今日充值数,总充值数")
@GetMapping("basicInformation")
public Result basicInformation() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
@ -74,13 +74,36 @@ public class AcLogController extends BaseController {
Integer userTotalCount=acUserService.count();
Integer userTodayCount=acUserService.lambdaQuery()
.between(AcUser::getCreatetime, Timestamp.valueOf(today),Timestamp.valueOf(tomorrow)).count();
Integer HomeviewTotalCount=entityService.lambdaQuery()
.eq(AcLog::getAction,"homeViews").count();
Integer HomeviewCount=entityService.lambdaQuery()
.eq(AcLog::getAction,"homeViews")
.between(AcLog::getCreatetime, Timestamp.valueOf(today),Timestamp.valueOf(tomorrow)).count();
BasicInformationVo basicInformationVo=new BasicInformationVo(userTotalCount,userTodayCount,HomeviewTotalCount,HomeviewCount);
List<PaConsumption> paConsumptions=paConsumptionService.lambdaQuery()
.between(PaConsumption::getCreatetime, Timestamp.valueOf(today),Timestamp.valueOf(tomorrow)).list();
Integer rechargeTodayAmount=0;
Integer consumptionTodayAmount=0;
for (PaConsumption paConsumption:paConsumptions){
if(paConsumption.getAddOrSub().equals("add")){
rechargeTodayAmount=rechargeTodayAmount+paConsumption.getValue();
}else{
consumptionTodayAmount=consumptionTodayAmount+paConsumption.getValue();
}
}
paConsumptions=paConsumptionService.lambdaQuery().list();
Integer rechargeAmount=0;
Integer consumptionAmount=0;
for (PaConsumption paConsumption:paConsumptions){
if(paConsumption.getAddOrSub().equals("add")){
rechargeAmount=rechargeAmount+paConsumption.getValue();
}else{
consumptionAmount=consumptionAmount+paConsumption.getValue();
}
}
BasicInformationVo basicInformationVo=new BasicInformationVo(userTotalCount,userTodayCount,HomeviewTotalCount,HomeviewCount,rechargeTodayAmount,rechargeAmount,consumptionTodayAmount,consumptionAmount);
return new Result(true, basicInformationVo);
}

View File

@ -15,4 +15,12 @@ public class BasicInformationVo {
private Integer HomeviewCount;
@ApiModelProperty("今日浏览数")
private Integer HomeviewTodayCount;
@ApiModelProperty("今日充值数")
private Integer rechargeTodayAmount;
@ApiModelProperty("总充值数")
private Integer rechargeAmount;
@ApiModelProperty("今日消费数")
private Integer consumptionTodayAmount;
@ApiModelProperty("总消费数")
private Integer consumptionAmount;
}

View File

@ -1,5 +1,8 @@
package com.pixelai.api.pa.controller;
import com.pixelai.api.pa.entity.PaCreation;
import com.pixelai.api.pa.vo.PaCollectionVo;
import com.pixelai.api.user.service.AcUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import com.base.annotation.SysLog;
import org.springframework.web.bind.annotation.RestController;
@ -19,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.validation.Valid;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -30,7 +34,7 @@ import java.util.Map;
* @author gjj
* @since 2024-12-05
*/
@Api(tags = "PaCollection")
@Api(tags = "用户收藏")
@RestController
@RequestMapping("/paCollection")
public class PaCollectionController extends BaseController {
@ -38,98 +42,108 @@ public class PaCollectionController extends BaseController {
private static final Logger LOG = LoggerFactory.getLogger(PaCollectionController.class);
@Autowired
private PaCollectionService entityService;
@Autowired
private AcUserService acUserService;
@SysLog(action = "findByPage", value = "分页查询订单")
@ApiOperation(value = "分页查询订单", notes = "分页查询订单")
@SysLog(action = "findByPage", value = "分页查询收藏")
@ApiOperation(value = "分页查询收藏", notes = "分页查询收藏")
@RequestMapping(method = RequestMethod.GET)
@ApiImplicitParams({@ApiImplicitParam(name = "size", value = "分页大小", paramType = "query"),
@ApiImplicitParam(name = "current", value = "当前页面从1开始", paramType = "query")})
public Result<IPage<PaCollection>> findByPage(final PaCollection example, final Page page) {
IPage<PaCollection> records = entityService.page(example,page);
public Result<IPage<PaCollectionVo>> findByPage(final PaCollection example, final Page page) {
IPage<PaCollectionVo> records = entityService.findByPage(example,page);
return new Result(true, records);
}
@SysLog(action = "delete", value = "删除订单")
@ApiOperation(value = "删除订单")
@SysLog(action = "delete", value = "删除收藏")
@ApiOperation(value = "删除收藏")
@RequestMapping(value = "{id}", method = {RequestMethod.DELETE})
@ApiImplicitParam(name = "id", value = "订单ID", required = true, paramType = "path")
@ApiImplicitParam(name = "id", value = "收藏ID", required = true, paramType = "path")
public Result delete(@PathVariable final Integer id) {
try {
entityService.removeById(id);
return new Result(true, "成功删除订单", null);
PaCollection paCollection = entityService.getById(id);
paCollection.setState("f");
entityService.updateById(paCollection);
return new Result(true, "成功删除收藏", null);
} catch (DataIntegrityViolationException e) {
LOG.error("删除订单失败", e);
return new Result(false, "删除订单失败", "该订单不能删除,存在其他关联数据");
LOG.error("删除收藏失败", e);
return new Result(false, "删除收藏失败", "该收藏不能删除,存在其他关联数据");
} catch (Exception e) {
LOG.error("删除订单失败", e);
return new Result(false, "删除订单失败", e.getMessage());
LOG.error("删除收藏失败", e);
return new Result(false, "删除收藏失败", e.getMessage());
}
}
@SysLog(action = "one", value = "查询单个订单")
@ApiOperation(value = "查询单个订单")
@RequestMapping(value = "{id}", method = {RequestMethod.GET})
@ApiImplicitParam(name = "id", value = "订单ID", required = true, paramType = "path")
public Result one(@PathVariable final Integer id) {
try {
PaCollection entity = entityService.getById(id);
return new Result(true, entity);
} catch (Exception e) {
LOG.error("查询单个订单失败", e);
return new Result(false, new PaCollection());
}
}
// @SysLog(action = "one", value = "查询单个收藏")
// @ApiOperation(value = "查询单个收藏")
// @RequestMapping(value = "{id}", method = {RequestMethod.GET})
// @ApiImplicitParam(name = "id", value = "收藏ID", required = true, paramType = "path")
// public Result one(@PathVariable final Integer id) {
// try {
// PaCollection entity = entityService.getById(id);
// return new Result(true, entity);
// } catch (Exception e) {
// LOG.error("查询单个收藏失败", e);
// return new Result(false, new PaCollection());
// }
// }
@SysLog(action = "add", value = "添加订单")
@ApiOperation(value = "添加订单")
@SysLog(action = "add", value = "收藏作品")
@ApiOperation(value = "收藏作品")
@RequestMapping(method = {RequestMethod.POST})
public Result add(@Valid @RequestBody final PaCollection entity, final BindingResult result) {
try {
if (result.hasErrors()) {
Map<String, String> map = this.getErrors(result);
String errorMsg = map.entrySet().iterator().next().getValue();
return new Result(false, "保存订单失败", errorMsg, map);
return new Result(false, "保存收藏失败", errorMsg, map);
} else {
Integer userid=acUserService.getUserId();
if (userid==null){
return new Result(false, "用户不存在");
}
entity.setState("t");
entity.setUserId(userid);
entity.setCreatetime(new Date());
entityService.save(entity);
return new Result(true, "成功保存订单", null);
return new Result(true, "成功保存收藏", null);
}
} catch (Exception e) {
LOG.error("添加订单失败", e);
return new Result(false, "保存订单失败", e.getMessage());
LOG.error("添加收藏失败", e);
return new Result(false, "保存收藏失败", e.getMessage());
}
}
@SysLog(action = "update", value = "修改订单")
@ApiOperation(value = "修改订单")
@RequestMapping(method = {RequestMethod.PUT})
public Result update(@Valid @RequestBody final PaCollection entity, final BindingResult result) {
try {
if (result.hasErrors()) {
Map<String, String> map = this.getErrors(result);
String errorMsg = map.entrySet().iterator().next().getValue();
return new Result(false, "修改订单失败", errorMsg, map);
} else {
if (null == entity.getId()) {
throw new RuntimeException("id不能为空");
}
entityService.updateById(entity);
return new Result(true, "成功修改订单", null);
}
} catch (Exception e) {
LOG.error("修改订单失败", e);
return new Result(false, "修改订单失败", e.getMessage());
}
}
@ApiOperation(value = "全部订单")
@RequestMapping(value = "all", method = RequestMethod.GET)
public Result<List<PaCollection>> all(PaCollection example) {
List<PaCollection> entitys = entityService.list(example);
if (null != entitys) {
return new Result<>(true, entitys);
}
return new Result<>(true, Collections.emptyList());
}
// @SysLog(action = "update", value = "修改收藏")
// @ApiOperation(value = "修改收藏")
// @RequestMapping(method = {RequestMethod.PUT})
// public Result update(@Valid @RequestBody final PaCollection entity, final BindingResult result) {
// try {
// if (result.hasErrors()) {
// Map<String, String> map = this.getErrors(result);
// String errorMsg = map.entrySet().iterator().next().getValue();
// return new Result(false, "修改收藏失败", errorMsg, map);
// } else {
// if (null == entity.getId()) {
// throw new RuntimeException("id不能为空");
// }
// entityService.updateById(entity);
// return new Result(true, "成功修改收藏", null);
// }
// } catch (Exception e) {
// LOG.error("修改收藏失败", e);
// return new Result(false, "修改收藏失败", e.getMessage());
// }
// }
//
// @ApiOperation(value = "全部收藏")
// @RequestMapping(value = "all", method = RequestMethod.GET)
// public Result<List<PaCollection>> all(PaCollection example) {
// List<PaCollection> entitys = entityService.list(example);
// if (null != entitys) {
// return new Result<>(true, entitys);
// }
// return new Result<>(true, Collections.emptyList());
// }
}

View File

@ -39,8 +39,8 @@ public class PaConsumptionController extends BaseController {
@Autowired
private PaConsumptionService entityService;
@SysLog(action = "findByPage", value = "分页查询订单")
@ApiOperation(value = "分页查询订单", notes = "分页查询订单")
@SysLog(action = "findByPage", value = "分页查询生成记录")
@ApiOperation(value = "分页查询生成记录", notes = "分页查询生成记录")
@RequestMapping(method = RequestMethod.GET)
@ApiImplicitParams({@ApiImplicitParam(name = "size", value = "分页大小", paramType = "query"),
@ApiImplicitParam(name = "current", value = "当前页面从1开始", paramType = "query")})
@ -49,79 +49,79 @@ public class PaConsumptionController extends BaseController {
return new Result(true, records);
}
@SysLog(action = "delete", value = "删除订单")
@ApiOperation(value = "删除订单")
@SysLog(action = "delete", value = "删除生成记录")
@ApiOperation(value = "删除生成记录")
@RequestMapping(value = "{id}", method = {RequestMethod.DELETE})
@ApiImplicitParam(name = "id", value = "订单ID", required = true, paramType = "path")
@ApiImplicitParam(name = "id", value = "生成记录ID", required = true, paramType = "path")
public Result delete(@PathVariable final Integer id) {
try {
entityService.removeById(id);
return new Result(true, "成功删除订单", null);
return new Result(true, "成功删除生成记录", null);
} catch (DataIntegrityViolationException e) {
LOG.error("删除订单失败", e);
return new Result(false, "删除订单失败", "该订单不能删除,存在其他关联数据");
LOG.error("删除生成记录失败", e);
return new Result(false, "删除生成记录失败", "该生成记录不能删除,存在其他关联数据");
} catch (Exception e) {
LOG.error("删除订单失败", e);
return new Result(false, "删除订单失败", e.getMessage());
LOG.error("删除生成记录失败", e);
return new Result(false, "删除生成记录失败", e.getMessage());
}
}
@SysLog(action = "one", value = "查询单个订单")
@ApiOperation(value = "查询单个订单")
@SysLog(action = "one", value = "查询单个生成记录")
@ApiOperation(value = "查询单个生成记录")
@RequestMapping(value = "{id}", method = {RequestMethod.GET})
@ApiImplicitParam(name = "id", value = "订单ID", required = true, paramType = "path")
@ApiImplicitParam(name = "id", value = "生成记录ID", required = true, paramType = "path")
public Result one(@PathVariable final Integer id) {
try {
PaConsumption entity = entityService.getById(id);
return new Result(true, entity);
} catch (Exception e) {
LOG.error("查询单个订单失败", e);
LOG.error("查询单个生成记录失败", e);
return new Result(false, new PaConsumption());
}
}
@SysLog(action = "add", value = "添加订单")
@ApiOperation(value = "添加订单")
@SysLog(action = "add", value = "添加生成记录")
@ApiOperation(value = "添加生成记录")
@RequestMapping(method = {RequestMethod.POST})
public Result add(@Valid @RequestBody final PaConsumption entity, final BindingResult result) {
try {
if (result.hasErrors()) {
Map<String, String> map = this.getErrors(result);
String errorMsg = map.entrySet().iterator().next().getValue();
return new Result(false, "保存订单失败", errorMsg, map);
return new Result(false, "保存生成记录失败", errorMsg, map);
} else {
entityService.save(entity);
return new Result(true, "成功保存订单", null);
return new Result(true, "成功保存生成记录", null);
}
} catch (Exception e) {
LOG.error("添加订单失败", e);
return new Result(false, "保存订单失败", e.getMessage());
LOG.error("添加生成记录失败", e);
return new Result(false, "保存生成记录失败", e.getMessage());
}
}
@SysLog(action = "update", value = "修改订单")
@ApiOperation(value = "修改订单")
@SysLog(action = "update", value = "修改生成记录")
@ApiOperation(value = "修改生成记录")
@RequestMapping(method = {RequestMethod.PUT})
public Result update(@Valid @RequestBody final PaConsumption entity, final BindingResult result) {
try {
if (result.hasErrors()) {
Map<String, String> map = this.getErrors(result);
String errorMsg = map.entrySet().iterator().next().getValue();
return new Result(false, "修改订单失败", errorMsg, map);
return new Result(false, "修改生成记录失败", errorMsg, map);
} else {
if (null == entity.getId()) {
throw new RuntimeException("id不能为空");
}
entityService.updateById(entity);
return new Result(true, "成功修改订单", null);
return new Result(true, "成功修改生成记录", null);
}
} catch (Exception e) {
LOG.error("修改订单失败", e);
return new Result(false, "修改订单失败", e.getMessage());
LOG.error("修改生成记录失败", e);
return new Result(false, "修改生成记录失败", e.getMessage());
}
}
@ApiOperation(value = "全部订单")
@ApiOperation(value = "全部生成记录")
@RequestMapping(value = "all", method = RequestMethod.GET)
public Result<List<PaConsumption>> all(PaConsumption example) {
List<PaConsumption> entitys = entityService.list(example);
@ -132,4 +132,3 @@ public class PaConsumptionController extends BaseController {
}
}

View File

@ -1,7 +1,14 @@
package com.pixelai.api.pa.dao;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pixelai.api.pa.entity.PaCollection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pixelai.api.pa.vo.PaCollectionVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@ -13,4 +20,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface PaCollectionMapper extends BaseMapper<PaCollection> {
List<PaCollectionVo> findByExample(@Param(Constants.WRAPPER)QueryWrapper<PaCollectionVo> paCollectionVoQueryWrapper, Page page);
}

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -33,9 +35,11 @@ public class PaCollection implements Serializable {
private Integer userId;
private LocalDateTime createtime;
private Date createtime;
private String state;
}

View File

@ -1,8 +1,10 @@
package com.pixelai.api.pa.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pixelai.api.pa.entity.PaCollection;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pixelai.api.pa.vo.PaCollectionVo;
import java.util.List;
@ -31,4 +33,5 @@ public interface PaCollectionService extends IService<PaCollection> {
*/
IPage<PaCollection> page(PaCollection example,IPage page);
IPage<PaCollectionVo> findByPage(PaCollection example, Page page);
}

View File

@ -2,10 +2,15 @@ package com.pixelai.api.pa.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pixelai.api.pa.entity.PaCollection;
import com.pixelai.api.pa.dao.PaCollectionMapper;
import com.pixelai.api.pa.service.PaCollectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pixelai.api.pa.vo.PaCollectionVo;
import com.pixelai.api.pa.vo.PaCreationVo;
import com.pixelai.api.user.service.AcUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@ -20,7 +25,8 @@ import java.util.List;
*/
@Service
public class PaCollectionServiceImpl extends ServiceImpl<PaCollectionMapper, PaCollection> implements PaCollectionService {
@Autowired
private AcUserService acUserService;
@Override
public List<PaCollection> list(PaCollection example) {
return this.list(buildWrapper(example));
@ -31,6 +37,23 @@ public class PaCollectionServiceImpl extends ServiceImpl<PaCollectionMapper, PaC
return this.page(page,buildWrapper(example));
}
@Override
public IPage<PaCollectionVo> findByPage(PaCollection example, Page page) {
page.setOptimizeCountSql(false);
return page.setRecords(this.baseMapper.findByExample(buildPaCollectionVoWrapper(example), page));
}
private QueryWrapper<PaCollectionVo> buildPaCollectionVoWrapper(PaCollection example) {
Integer userId=acUserService.getUserId();
QueryWrapper<PaCollectionVo> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", userId)
.eq("collection_state", "t")
.eq("photo_state", "t")
.eq("creation_state", "t")
.orderByDesc("createtime");
return wrapper;
}
/**
* 构建查询
*

View File

@ -6,6 +6,9 @@ import com.pixelai.api.pa.entity.PaConsumption;
import com.pixelai.api.pa.dao.PaConsumptionMapper;
import com.pixelai.api.pa.service.PaConsumptionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pixelai.api.user.entity.AcUser;
import com.pixelai.api.user.service.AcUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@ -20,7 +23,8 @@ import java.util.List;
*/
@Service
public class PaConsumptionServiceImpl extends ServiceImpl<PaConsumptionMapper, PaConsumption> implements PaConsumptionService {
@Autowired
private AcUserService acUserService;
@Override
public List<PaConsumption> list(PaConsumption example) {
return this.list(buildWrapper(example));
@ -39,6 +43,12 @@ public class PaConsumptionServiceImpl extends ServiceImpl<PaConsumptionMapper, P
*/
private QueryWrapper<PaConsumption> buildWrapper(PaConsumption example) {
QueryWrapper<PaConsumption> wrapper = new QueryWrapper<>();
Integer userId=acUserService.getUserId();
AcUser acuser=acUserService.getById(userId);
if (acuser.getAcgroup()!=1){
wrapper.lambda().eq(PaConsumption::getUserid,userId);
}
wrapper.orderByDesc("createtime");
return wrapper;
}

View File

@ -0,0 +1,12 @@
package com.pixelai.api.pa.vo;
import com.pixelai.api.pa.entity.PaCollection;
import com.pixelai.api.pa.entity.PaCreation;
import lombok.Data;
@Data
public class PaCollectionVo extends PaCollection {
String path;
String type;
Integer reviewStatus;
}

View File

@ -64,7 +64,7 @@ public class ScheduledTasks {
//每隔30秒拉取一次阿里云火山生成结果
@Scheduled(fixedRate = 30*1000)
// @Scheduled(fixedRate = 30*1000)
public void getCreationUrl() throws Exception {
//2阿里云3火山
List<PaCreation> paCreations= paCreationService.lambdaQuery()

View File

@ -107,6 +107,9 @@ public class VolcengineUtil {
case 50429:
errorMessage="当前使用人数过多,请重试";
break;
case 50501:
errorMessage="服务器内部RPC错误,正在重试";
break;
}
return errorMessage;
}

View File

@ -178,7 +178,7 @@ public class AcUserController extends BaseController {
if (!toLogin) {
return new Result(false, "登录失败", "登录失败次数超过5次请半个小时后再进行尝试");
}
AcUser user = entityService.findByUsername(login.getUsername());
AcUser user = entityService.findByUsername(login.getUsername(),1);
if (null == user) {
acLoginlogService.addLog(null, login.getUsername(), "f", "该账号不存在");
return new Result(false, "该账号不存在", "该账号不存在");

View File

@ -40,7 +40,7 @@ public interface AcUserMapper extends BaseMapper<AcUser> {
* @param username
* @return
*/
AcUser findByUsername(@Param("username") String username);
AcUser findByUsername(@Param("username") String username,@Param("usertype") Integer usertype);
/**
* 条件查询

View File

@ -72,7 +72,7 @@ public interface AcUserService extends IService<AcUser> {
* @param username
* @return
*/
AcUser findByUsername(String username);
AcUser findByUsername(String username,Integer usertype);
/**
* 设置订单状态

View File

@ -68,7 +68,7 @@ public class AcUserServiceImpl extends ServiceImpl<AcUserMapper, AcUser> impleme
}
@Override
public Result<LoginSuccessVo> phoneLogin(String username, String password) {
AcUser user = this.findByUsername(username);
AcUser user = this.findByUsername(username,2);
if(user==null){
return new Result<>(false,"用户不存在","");
}
@ -130,7 +130,7 @@ public class AcUserServiceImpl extends ServiceImpl<AcUserMapper, AcUser> impleme
if(!password.equals(confirmPassword)){
return new Result<>(false,"两次输入的密码不一致");
}
AcUser acUser=acUserMapper.findByUsername(username);
AcUser acUser=acUserMapper.findByUsername(username,2);
if(acUser!=null){
return new Result<>(false,"用户已存在,无法注册");
}
@ -281,8 +281,8 @@ public class AcUserServiceImpl extends ServiceImpl<AcUserMapper, AcUser> impleme
}
@Override
public AcUser findByUsername(String username) {
return this.baseMapper.findByUsername(username);
public AcUser findByUsername(String username,Integer usertype) {
return this.baseMapper.findByUsername(username,usertype);
}
@Override
@ -312,7 +312,7 @@ public class AcUserServiceImpl extends ServiceImpl<AcUserMapper, AcUser> impleme
acUser.setPwdupdatetime(new Date());
acUser.setState("1");
if (this.save(acUser)) {
return this.findByUsername(examinee.getUsername());
return this.findByUsername(examinee.getUsername(),2);
} else {
return null;
}
@ -331,7 +331,7 @@ public class AcUserServiceImpl extends ServiceImpl<AcUserMapper, AcUser> impleme
acUser.setPwdupdatetime(new Date());
acUser.setState("1");
if (this.save(acUser)) {
return this.findByUsername(student.getUsername());
return this.findByUsername(student.getUsername(),2);
} else {
return null;
}

View File

@ -79,7 +79,7 @@
<select id="findByUsername" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
FROM ac_user where username = #{username} and state = 't'
FROM ac_user where username = #{username} and usertype = #{usertype} and state = 't'
</select>
<select id="findByExample" resultType="com.pixelai.api.user.vo.AcUserVo"

View File

@ -16,4 +16,36 @@
id, creation_id, user_id, createtime, state
</sql>
<select id="findByExample" resultType="com.pixelai.api.pa.vo.PaCollectionVo"
parameterType="com.pixelai.api.pa.vo.PaCollectionVo">
select
id,
name,
photo_id,
user_id,
createtime,
path,
type,
review_status
from (select
pa_creation."id",
pa_creation."name",
pa_creation.photo_id,
pa_creation.user_id,
pa_creation.createtime,
pa_collection."state" as collection_state,
pa_creation."state" as creation_state,
cp_attachment."path",
cp_attachment."state" as photo_state,
pa_services."name" as type,
pa_creation_release.review_status
from pa_collection
left join pa_creation on pa_creation.id=pa_collection.creation_id
left join pa_services on pa_services.id=pa_creation.service_id
left join pa_creation_release on pa_creation_release.creation_id=pa_creation.id
left join cp_attachment on cp_attachment.id=pa_creation.photo_id) t
${ew.customSqlSegment}
</select>
</mapper>