提交 5ea9b01e 作者: 刘明祎-运维用途

培训机构只能看自己的

上级 de6f5ef7
流水线 #7101 已通过 于阶段
in 2 分 57 秒
...@@ -46,6 +46,9 @@ public class LicenseOrganizationsQO { ...@@ -46,6 +46,9 @@ public class LicenseOrganizationsQO {
@ApiModelProperty(value = "地域region", example = "110000", required = false) @ApiModelProperty(value = "地域region", example = "110000", required = false)
private String region; private String region;
@ApiModelProperty(value = "后台id")
private Integer backUserId;
@ApiModelProperty(value = "当前页", required = true, example = "1") @ApiModelProperty(value = "当前页", required = true, example = "1")
@NotNull(message = "当前页不能为空", groups = {Page.class, Freeze.class}) @NotNull(message = "当前页不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
......
package com.mmc.csf.licence.vo; package com.mmc.csf.licence.vo;
import com.mmc.csf.release.model.group.Create; import com.mmc.csf.release.model.group.Create;
import com.mmc.csf.release.model.group.Page;
import com.mmc.csf.release.model.group.Update; import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.Value;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List; import java.util.List;
/** /**
...@@ -41,7 +41,7 @@ public class LicenseOrganizationsVO { ...@@ -41,7 +41,7 @@ public class LicenseOrganizationsVO {
private String name; private String name;
@ApiModelProperty(value = "机构地区编号", example = "110000,130100", required = true) @ApiModelProperty(value = "机构地区编号", example = "110000,130100", required = true)
@NotBlank(message = "机构地区不能为空", groups = {Create.class, Update.class}) // @NotBlank(message = "机构地区不能为空", groups = {Create.class, Update.class})
private String region; private String region;
@ApiModelProperty(value = "机构地区名称", example = "河北省,石家庄市", required = false) @ApiModelProperty(value = "机构地区名称", example = "河北省,石家庄市", required = false)
...@@ -82,5 +82,7 @@ public class LicenseOrganizationsVO { ...@@ -82,5 +82,7 @@ public class LicenseOrganizationsVO {
@Valid @Valid
private List<LicenseTrainingProgramsVO> trainingProgramsVOS; private List<LicenseTrainingProgramsVO> trainingProgramsVOS;
@ApiModelProperty(value = "后台id")
private Integer backUserId;
} }
...@@ -93,6 +93,9 @@ public class LicenseOrganizationsDO { ...@@ -93,6 +93,9 @@ public class LicenseOrganizationsDO {
@ApiModelProperty(value = "更新时间", example = "2023-07-14", required = true) @ApiModelProperty(value = "更新时间", example = "2023-07-14", required = true)
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "后台账号id")
private Integer backUserId;
/** /**
* VO类转换 * VO类转换
*/ */
...@@ -111,6 +114,7 @@ public class LicenseOrganizationsDO { ...@@ -111,6 +114,7 @@ public class LicenseOrganizationsDO {
this.regionName = organizationsVO.getRegionName(); this.regionName = organizationsVO.getRegionName();
this.longitude = organizationsVO.getLongitude(); this.longitude = organizationsVO.getLongitude();
this.latitude = organizationsVO.getLatitude(); this.latitude = organizationsVO.getLatitude();
this.backUserId = organizationsVO.getBackUserId();
} }
......
...@@ -117,11 +117,13 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService { ...@@ -117,11 +117,13 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
private void getOrgName(LicenseOrganizationsVO organizations) { private void getOrgName(LicenseOrganizationsVO organizations) {
String region = organizations.getRegion(); String region = organizations.getRegion();
List<String> strings = Arrays.asList(region.split(",")); if(region != null) {
List<Integer> collect = strings.stream().map(Integer::valueOf).collect(Collectors.toList()); List<String> strings = Arrays.asList(region.split(","));
List<String> orgName = licenceBackgroundDao.getOrgName(collect); List<Integer> collect = strings.stream().map(Integer::valueOf).collect(Collectors.toList());
String join = StringUtils.join(orgName, ","); List<String> orgName = licenceBackgroundDao.getOrgName(collect);
organizations.setRegionName(join); String join = StringUtils.join(orgName, ",");
organizations.setRegionName(join);
}
} }
@Override @Override
...@@ -137,6 +139,8 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService { ...@@ -137,6 +139,8 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
if (count == 0) { if (count == 0) {
return PageResult.buildPage(organizationsQO.getPageNo(), organizationsQO.getPageSize(), count); return PageResult.buildPage(organizationsQO.getPageNo(), organizationsQO.getPageSize(), count);
} }
Integer backUserId = userLoginInfoFromRedis.getUserAccountId();
organizationsQO.setBackUserId(backUserId);
Integer pageNo = organizationsQO.getPageNo(); Integer pageNo = organizationsQO.getPageNo();
organizationsQO.buildCurrentPage(); organizationsQO.buildCurrentPage();
List<LicenseOrganizationsDO> licenseOrganizationsDOS = licenceBackgroundDao.listOrgPage(organizationsQO); List<LicenseOrganizationsDO> licenseOrganizationsDOS = licenceBackgroundDao.listOrgPage(organizationsQO);
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
insert into license_organizations(main_image, auxiliary_picture, video, `name`, region, region_name, insert into license_organizations(main_image, auxiliary_picture, video, `name`, region, region_name,
detailed_address, detailed_address,
test_center, scale_id, test_center, scale_id,
description, detail, create_time, update_time, longitude, latitude) description, detail, create_time, update_time, longitude, latitude,back_user_id)
values (#{mainImage}, #{auxiliaryPicture}, #{video}, #{name}, #{region}, #{regionName}, #{detailedAddress}, values (#{mainImage}, #{auxiliaryPicture}, #{video}, #{name}, #{region}, #{regionName}, #{detailedAddress},
#{testCenter}, #{testCenter},
#{scaleId}, #{scaleId},
#{description}, #{detail}, NOW(), NOW(), #{longitude}, #{latitude}) #{description}, #{detail}, NOW(), NOW(), #{longitude}, #{latitude},#{backUserId})
</insert> </insert>
...@@ -189,6 +189,9 @@ ...@@ -189,6 +189,9 @@
FROM license_organizations lo FROM license_organizations lo
LEFT JOIN licence_scale ls ON lo.scale_id = ls.id LEFT JOIN licence_scale ls ON lo.scale_id = ls.id
where 1=1 where 1=1
<if test="backUserId != 1">
and lo.back_user_id = #{backUserId}
</if>
<if test=" name != null and name != '' "> <if test=" name != null and name != '' ">
and lo.`name` like CONCAT('%',#{name},'%') and lo.`name` like CONCAT('%',#{name},'%')
</if> </if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论