mp表新增字段:type 是否主账号

This commit is contained in:
2024-07-24 23:55:02 +08:00
parent b141d95161
commit d896646c30
7 changed files with 21 additions and 1 deletions
@@ -259,6 +259,10 @@ public class MpController extends BaseController {
@ApiOperation("修改小程序信息")
@PutMapping()
public ApiResult<?> update(@RequestBody Mp mp) {
// 只允许一个主账号
if (mp.getType().equals(1)) {
mpService.update(new LambdaUpdateWrapper<Mp>().eq(Mp::getType,1).set(Mp::getType,0));
}
if (mpService.updateById(mp)) {
return success("修改成功");
}
@@ -30,6 +30,9 @@ public class Mp implements Serializable {
@TableId(value = "mp_id", type = IdType.AUTO)
private Integer mpId;
@ApiModelProperty(value = "是否主账号")
private Integer type;
@ApiModelProperty(value = "小程序ID")
private String appId;
@@ -11,6 +11,9 @@
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.pageId != null">
AND a.page_id = #{param.pageId}
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
@@ -10,6 +10,9 @@
<if test="param.mpId != null">
AND a.mp_id = #{param.mpId}
</if>
<if test="param.type != null">
AND a.type LIKE CONCAT('%', #{param.type}, '%')
</if>
<if test="param.appId != null">
AND a.app_id LIKE CONCAT('%', #{param.appId}, '%')
</if>
@@ -27,6 +27,10 @@ public class MpFieldParam extends BaseParam {
@QueryField(type = QueryType.EQ)
private Integer id;
@ApiModelProperty(value = "页面ID")
@QueryField(type = QueryType.EQ)
private Integer pageId;
@ApiModelProperty(value = "类型,0文本 1图片 2其他")
@QueryField(type = QueryType.EQ)
private Integer type;
@@ -27,6 +27,9 @@ public class MpParam extends BaseParam {
@QueryField(type = QueryType.EQ)
private Integer mpId;
@ApiModelProperty(value = "是否主账号")
private Integer type;
@ApiModelProperty(value = "小程序ID")
private String appId;
@@ -23,7 +23,7 @@ public class MpServiceImpl extends ServiceImpl<MpMapper, Mp> implements MpServic
@Override
public PageResult<Mp> pageRel(MpParam param) {
PageParam<Mp, MpParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
page.setDefaultOrder("type desc, sort_number asc, create_time desc");
List<Mp> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}