parent
457d95cb55
commit
2ef373c580
14 changed files with 432 additions and 17 deletions
@ -0,0 +1,48 @@ |
||||
package com.huoran.nakadai.controller; |
||||
|
||||
|
||||
import com.huoran.common.response.R; |
||||
import com.huoran.common.utils.TokenUtils; |
||||
import com.huoran.nakadai.service.MallProjectConfigService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.validation.constraints.NotNull; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品关联项目表 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author chen |
||||
* @since 2024-12-18 |
||||
*/ |
||||
@RestController |
||||
@Api(value = "产品关联项目管理", tags = "M-产品关联项目管理") |
||||
@RequestMapping("/mallProjectConfig") |
||||
public class MallProjectConfigController { |
||||
|
||||
@Autowired |
||||
private MallProjectConfigService mallProjectConfigService; |
||||
|
||||
@ApiOperation(value = "获取商品关联项目系统列表") |
||||
@GetMapping("/getSystemListOfMall") |
||||
public R getSystemListOfMall(@NotNull(message = "系统类型") Integer type,HttpServletRequest request) { |
||||
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request); |
||||
return mallProjectConfigService.getSystemListOfMall(schoolId,type); |
||||
} |
||||
|
||||
|
||||
@ApiOperation(value = "大赛中 系统id查询商品关联项目") |
||||
@GetMapping("/getProjectListOfSystem") |
||||
public R getProjectListOfSystem(@NotNull(message = "系统id不能为空") Integer systemId, HttpServletRequest request) { |
||||
Integer schoolId = TokenUtils.getSchoolIdByJwtToken(request); |
||||
return mallProjectConfigService.getProjectListOfSystem(schoolId,systemId); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,69 @@ |
||||
package com.huoran.nakadai.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品关联项目表 |
||||
* </p> |
||||
* |
||||
* @author chen |
||||
* @since 2024-12-18 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@TableName("hr_mall_project_config") |
||||
@ApiModel(value="MallProjectConfig对象", description="产品关联项目表") |
||||
public class MallProjectConfig implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "主键") |
||||
@TableId(value = "config_id", type = IdType.AUTO) |
||||
private Integer configId; |
||||
|
||||
@ApiModelProperty(value = "商城主键id") |
||||
private Integer mallId; |
||||
|
||||
@ApiModelProperty(value = "系统id") |
||||
private Integer systemId; |
||||
|
||||
@ApiModelProperty(value = "项目管理表id") |
||||
private Integer projectId; |
||||
|
||||
@ApiModelProperty(value = "排序(对项目展示进行排序)") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty(value = "项目权限(0、练习 1、考核、2大赛)") |
||||
private Integer permissions; |
||||
|
||||
@ApiModelProperty(value = "是否展示(默认0展示 1为不展示)") |
||||
private Integer isShow; |
||||
|
||||
@ApiModelProperty(value = "是否删除(默认0未删 1为已删除)") |
||||
private Integer isDel; |
||||
|
||||
@ApiModelProperty(value = "试卷id") |
||||
private Integer paperId; |
||||
|
||||
@ApiModelProperty(value = "更新时间") |
||||
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") |
||||
private Date updateTime; |
||||
|
||||
@ApiModelProperty(value = "创建时间") |
||||
@TableField(fill = FieldFill.INSERT) |
||||
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") |
||||
private Date createTime; |
||||
|
||||
} |
@ -0,0 +1,47 @@ |
||||
package com.huoran.nakadai.entity.res; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class MallProjectConfigRes { |
||||
@ApiModelProperty(value = "产品id") |
||||
private Integer mallId; |
||||
|
||||
@ApiModelProperty(value = "项目名称/试卷名称") |
||||
private String projectName; |
||||
|
||||
@ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)") |
||||
private Integer permissions; |
||||
|
||||
@ApiModelProperty(value = "系统名称") |
||||
private String applicationName; |
||||
|
||||
@ApiModelProperty(value = "系统名称") |
||||
private String systemName; |
||||
|
||||
@ApiModelProperty(value = "排序(对项目展示进行排序)") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty(value = "项目id") |
||||
private Integer projectId; |
||||
|
||||
@ApiModelProperty(value = "配置id") |
||||
private Integer configId; |
||||
|
||||
@ApiModelProperty(value = "是否展示(默认0展示 1为不展示)") |
||||
private Integer isShow; |
||||
|
||||
@ApiModelProperty(value = "系统id") |
||||
private Integer systemId; |
||||
|
||||
@ApiModelProperty(value = "系统类型") |
||||
private Integer type; |
||||
|
||||
@ApiModelProperty(value = "备注") |
||||
private String remark; |
||||
|
||||
//试卷id
|
||||
@ApiModelProperty(value = "试卷id") |
||||
private Integer paperId; |
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.huoran.nakadai.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.huoran.nakadai.entity.MallProjectConfig; |
||||
import com.huoran.nakadai.entity.res.MallProjectConfigRes; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品关联项目表 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author chen |
||||
* @since 2024-12-18 |
||||
*/ |
||||
public interface MallProjectConfigMapper extends BaseMapper<MallProjectConfig> { |
||||
|
||||
List<MallProjectConfigRes> selectMallProjectConfig(@Param("mallId") Integer mallId,@Param("permissions") Integer permissions); |
||||
|
||||
List<MallProjectConfigRes> getSystemListOfMall(@Param("schoolId")Integer schoolId,@Param("type")Integer type); |
||||
|
||||
List<MallProjectConfigRes> getProjectListOfSystem(@Param("schoolId")Integer schoolId, @Param("systemId")Integer systemId); |
||||
} |
@ -0,0 +1,118 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.huoran.nakadai.mapper.MallProjectConfigMapper"> |
||||
|
||||
<select id="selectMallProjectConfig" resultType="com.huoran.nakadai.entity.res.MallProjectConfigRes"> |
||||
SELECT |
||||
c.mall_id, |
||||
c.config_id, |
||||
c.project_id, |
||||
c.paper_id, |
||||
c.permissions, |
||||
c.is_show, |
||||
CASE |
||||
WHEN c.project_id IS NOT NULL THEN |
||||
m.project_name |
||||
WHEN c.paper_id IS NOT NULL THEN |
||||
p.NAME |
||||
END AS projectName, |
||||
c.sort, |
||||
s.system_name AS applicationName, |
||||
s.system_name AS system_name, |
||||
c.system_id, |
||||
s.type, |
||||
IFNULL( |
||||
CASE |
||||
|
||||
WHEN c.project_id IS NOT NULL THEN |
||||
m.remark |
||||
WHEN c.paper_id IS NOT NULL THEN |
||||
p.NAME |
||||
END, |
||||
m.project_name |
||||
) remark |
||||
FROM |
||||
hr_mall_project_config c |
||||
LEFT JOIN occupationlab.ol_project_manage m ON m.project_id = c.project_id |
||||
AND m.zt_del = 0 |
||||
LEFT JOIN service_configuration s ON s.system_id = c.system_id |
||||
LEFT JOIN exam.exam_paper p ON p.paper_id = c.paper_id |
||||
WHERE |
||||
c.is_del = 0 |
||||
AND c.permissions = #{permissions} |
||||
AND c.mall_id = #{mallId} |
||||
ORDER BY |
||||
c.sort; |
||||
</select> |
||||
<select id="getSystemListOfMall" resultType="com.huoran.nakadai.entity.res.MallProjectConfigRes"> |
||||
SELECT sc.system_id,sc.system_name,sc.type |
||||
FROM hr_order o |
||||
INNER JOIN customer c ON c.customer_id = o.customer_id |
||||
INNER JOIN order_other ot ON o.order_id = ot.order_id |
||||
INNER JOIN hr_mall_project_config pc ON pc.mall_id = ot.mall_id |
||||
INNER JOIN service_configuration sc ON sc.system_id = pc.system_id |
||||
WHERE o.is_del = 0 |
||||
AND ot.is_del = 0 |
||||
AND ot.is_enable = 1 |
||||
AND c.school_id = #{schoolId} |
||||
AND o.order_status = 1 and unix_timestamp(ot.start_time) <![CDATA[ <= ]]> unix_timestamp(NOW()) and unix_timestamp(ot.end_time) <![CDATA[ >= ]]> unix_timestamp(NOW()) |
||||
<if test='type != null and type == 1'> |
||||
AND sc.type != 2 AND sc.type != 3 |
||||
</if> |
||||
<if test='type != null and type == 3'> |
||||
AND sc.type = #{type} |
||||
</if> |
||||
GROUP BY pc.system_id |
||||
</select> |
||||
<select id="getProjectListOfSystem" resultType="com.huoran.nakadai.entity.res.MallProjectConfigRes"> |
||||
SELECT |
||||
pc.mall_id, |
||||
pc.config_id, |
||||
pc.project_id, |
||||
pc.paper_id, |
||||
pc.permissions, |
||||
pc.is_show, |
||||
CASE |
||||
|
||||
WHEN pc.project_id IS NOT NULL THEN |
||||
m.project_name |
||||
WHEN pc.paper_id IS NOT NULL THEN |
||||
p.NAME |
||||
END AS projectName, |
||||
pc.sort, |
||||
sc.system_name AS applicationName, |
||||
sc.system_name AS system_name, |
||||
pc.system_id, |
||||
sc.type, |
||||
IFNULL( |
||||
CASE |
||||
|
||||
WHEN pc.project_id IS NOT NULL THEN |
||||
m.remark |
||||
WHEN pc.paper_id IS NOT NULL THEN |
||||
p.NAME |
||||
END, |
||||
m.project_name |
||||
) remark |
||||
FROM |
||||
hr_order o |
||||
INNER JOIN customer c ON c.customer_id = o.customer_id |
||||
INNER JOIN order_other ot ON o.order_id = ot.order_id |
||||
INNER JOIN hr_mall_project_config pc ON pc.mall_id = ot.mall_id |
||||
INNER JOIN service_configuration sc ON sc.system_id = pc.system_id |
||||
LEFT JOIN occupationlab.ol_project_manage m ON m.project_id = pc.project_id |
||||
AND m.zt_del = 0 |
||||
LEFT JOIN exam.exam_paper p ON p.paper_id = pc.paper_id |
||||
WHERE |
||||
o.is_del = 0 |
||||
AND ot.is_del = 0 |
||||
AND ot.is_enable = 1 |
||||
AND c.school_id = #{schoolId} |
||||
AND o.order_status = 1 |
||||
AND pc.is_del = 0 |
||||
AND pc.system_id = #{systemId} |
||||
AND o.order_status = 1 and unix_timestamp(ot.start_time) <![CDATA[ <= ]]> unix_timestamp(NOW()) and unix_timestamp(ot.end_time) <![CDATA[ >= ]]> unix_timestamp(NOW()) |
||||
ORDER BY |
||||
pc.sort |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,20 @@ |
||||
package com.huoran.nakadai.service; |
||||
|
||||
import com.huoran.common.response.R; |
||||
import com.huoran.nakadai.entity.MallProjectConfig; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品关联项目表 服务类 |
||||
* </p> |
||||
* |
||||
* @author chen |
||||
* @since 2024-12-18 |
||||
*/ |
||||
public interface MallProjectConfigService extends IService<MallProjectConfig> { |
||||
|
||||
R getSystemListOfMall(Integer schoolId,Integer type); |
||||
|
||||
R getProjectListOfSystem(Integer schoolId, Integer systemId); |
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.huoran.nakadai.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.huoran.common.response.R; |
||||
import com.huoran.nakadai.entity.MallProjectConfig; |
||||
import com.huoran.nakadai.entity.res.MallProjectConfigRes; |
||||
import com.huoran.nakadai.mapper.MallProjectConfigMapper; |
||||
import com.huoran.nakadai.service.MallProjectConfigService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品关联项目表 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author chen |
||||
* @since 2024-12-18 |
||||
*/ |
||||
@Service |
||||
public class MallProjectConfigServiceImpl extends ServiceImpl<MallProjectConfigMapper, MallProjectConfig> implements MallProjectConfigService { |
||||
|
||||
@Override |
||||
public R getSystemListOfMall(Integer schoolId,Integer type) { |
||||
List<MallProjectConfigRes> mallProjectConfigRes = baseMapper.getSystemListOfMall(schoolId,type); |
||||
return R.ok().put("data",mallProjectConfigRes); |
||||
} |
||||
|
||||
@Override |
||||
public R getProjectListOfSystem(Integer schoolId, Integer systemId) { |
||||
List<MallProjectConfigRes> mallProjectConfigRes = baseMapper.getProjectListOfSystem(schoolId,systemId); |
||||
return R.ok().put("data",mallProjectConfigRes); |
||||
} |
||||
} |
Loading…
Reference in new issue