| @ -0,0 +1,50 @@ | |||
| package com.hxhq.business.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import com.hxhq.common.security.annotation.RequiresPermissions; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.hxhq.business.domain.Template; | |||
| import com.hxhq.business.service.ITemplateService; | |||
| import com.hxhq.common.core.web.controller.BaseController; | |||
| import com.hxhq.common.core.web.domain.AjaxResult; | |||
| import com.hxhq.common.core.web.page.TableDataInfo; | |||
| /** | |||
| * 模板Controller | |||
| * | |||
| * @author hxhq | |||
| * @date 2025-12-23 | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/business/template") | |||
| public class TemplateController extends BaseController | |||
| { | |||
| @Autowired | |||
| private ITemplateService templateService; | |||
| /** | |||
| * 查询模板列表 | |||
| */ | |||
| @RequiresPermissions("business:template:list") | |||
| @GetMapping("/list") | |||
| public TableDataInfo list(Template template) | |||
| { | |||
| startPage(); | |||
| List<Template> list = templateService.queryList(template); | |||
| return getDataTable(list); | |||
| } | |||
| /** | |||
| * 获取模板详细信息 | |||
| */ | |||
| @RequiresPermissions("business:template:list") | |||
| @GetMapping(value = "/info") | |||
| public AjaxResult getInfo(Long id) | |||
| { | |||
| return AjaxResult.success(templateService.getById(id)); | |||
| } | |||
| } | |||
| @ -0,0 +1,96 @@ | |||
| package com.hxhq.business.domain; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.hxhq.common.core.domain.MpBaseEntity; | |||
| /** | |||
| * 模板对象 t_template | |||
| * | |||
| * @author hxhq | |||
| * @date 2025-12-23 | |||
| */ | |||
| @TableName("t_template") | |||
| public class Template extends MpBaseEntity | |||
| { | |||
| private static final long serialVersionUID = 1L; | |||
| /** 编号 */ | |||
| private String sn; | |||
| /** 模板名称 */ | |||
| private String name; | |||
| /** 所属部门/学科 */ | |||
| private Long deptId; | |||
| /** 状态1禁用,10启用 */ | |||
| private Integer status; | |||
| /** 内容 */ | |||
| private String content; | |||
| /** 部门名称 */ | |||
| @TableField(exist = false) | |||
| private String deptName; | |||
| public void setSn(String sn) | |||
| { | |||
| this.sn = sn; | |||
| } | |||
| public String getSn() | |||
| { | |||
| return sn; | |||
| } | |||
| public void setName(String name) | |||
| { | |||
| this.name = name; | |||
| } | |||
| public String getName() | |||
| { | |||
| return name; | |||
| } | |||
| public void setDeptId(Long deptId) | |||
| { | |||
| this.deptId = deptId; | |||
| } | |||
| public Long getDeptId() | |||
| { | |||
| return deptId; | |||
| } | |||
| public void setStatus(Integer status) | |||
| { | |||
| this.status = status; | |||
| } | |||
| public Integer getStatus() | |||
| { | |||
| return status; | |||
| } | |||
| public void setContent(String content) | |||
| { | |||
| this.content = content; | |||
| } | |||
| public String getContent() | |||
| { | |||
| return content; | |||
| } | |||
| public String getDeptName() { | |||
| return deptName; | |||
| } | |||
| public void setDeptName(String deptName) { | |||
| this.deptName = deptName; | |||
| } | |||
| } | |||
| @ -0,0 +1,51 @@ | |||
| package com.hxhq.business.enums; | |||
| /** | |||
| * 状态类型:1禁用,3启用 | |||
| * @author tanfei | |||
| */ | |||
| public enum NormalEnum { | |||
| /** | |||
| * 1禁用 | |||
| */ | |||
| no(1, "部门"), | |||
| /** | |||
| * 3启用 | |||
| */ | |||
| yes(3, "学科"); | |||
| private int value; | |||
| private String text; | |||
| NormalEnum(int value, String text) { | |||
| this.value = value; | |||
| this.text = text; | |||
| } | |||
| public int getValue() { | |||
| return value; | |||
| } | |||
| public void setValue(int value) { | |||
| this.value = value; | |||
| } | |||
| public String getText() { | |||
| return text; | |||
| } | |||
| public void setText(String text) { | |||
| this.text = text; | |||
| } | |||
| public static NormalEnum getEnumByValue(int type) { | |||
| for (NormalEnum bt : values()) { | |||
| if (bt.value == type) { | |||
| return bt; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @ -0,0 +1,24 @@ | |||
| package com.hxhq.business.mapper; | |||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
| import com.hxhq.business.domain.Template; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| * 模板Mapper接口 | |||
| * | |||
| * @author hxhq | |||
| * @date 2025-12-23 | |||
| */ | |||
| public interface TemplateMapper extends BaseMapper<Template> | |||
| { | |||
| /** | |||
| * 获取列表 | |||
| * @param queryWrapper | |||
| * @return | |||
| */ | |||
| List<Template> queryList(@Param("ew") Wrapper<Template> queryWrapper); | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| package com.hxhq.business.service; | |||
| import java.util.List; | |||
| import com.hxhq.business.domain.Template; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * 模板Service接口 | |||
| * | |||
| * @author hxhq | |||
| * @date 2025-12-23 | |||
| */ | |||
| public interface ITemplateService extends IService<Template> | |||
| { | |||
| /** | |||
| * 查询模板列表 | |||
| * | |||
| * @param template 模板 | |||
| * @return 模板集合 | |||
| */ | |||
| public List<Template> queryList(Template template); | |||
| } | |||
| @ -0,0 +1,47 @@ | |||
| package com.hxhq.business.service.impl; | |||
| import java.util.List; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
| import com.hxhq.common.core.utils.StringUtils; | |||
| import org.springframework.stereotype.Service; | |||
| import com.hxhq.business.mapper.TemplateMapper; | |||
| import com.hxhq.business.domain.Template; | |||
| import com.hxhq.business.service.ITemplateService; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * 模板Service业务层处理 | |||
| * | |||
| * @author hxhq | |||
| * @date 2025-12-23 | |||
| */ | |||
| @Service | |||
| public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> implements ITemplateService | |||
| { | |||
| /** | |||
| * 查询模板列表 | |||
| * | |||
| * @param template 模板 | |||
| * @return 模板 | |||
| */ | |||
| @Override | |||
| public List<Template> queryList(Template template) | |||
| { | |||
| QueryWrapper<Template> queryWrapper = Wrappers.query(); | |||
| if(StringUtils.isNoneBlank(template.getSn())){ | |||
| queryWrapper.like("t.sn",template.getSn()); | |||
| } | |||
| if(StringUtils.isNoneBlank(template.getName())){ | |||
| queryWrapper.like("t.name",template.getName()); | |||
| } | |||
| if(template.getDeptId()!=null && template.getDeptId().longValue()>0){ | |||
| queryWrapper.eq("t.dept_id",template.getDeptId()); | |||
| } | |||
| if(template.getStatus()!=null && template.getStatus().intValue()>0){ | |||
| queryWrapper.eq("t.status",template.getStatus()); | |||
| } | |||
| return baseMapper.queryList(queryWrapper); | |||
| } | |||
| } | |||
| @ -0,0 +1,16 @@ | |||
| <?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.hxhq.business.mapper.TemplateMapper"> | |||
| <select id="queryList"> | |||
| SELECT t.`id`,t.`sn`,t.`name`,t.`dept_id`,t.`status`,d.`dept_name` | |||
| FROM `t_template` t | |||
| LEFT JOIN `sys_dept` d ON t.`dept_id`=d.`dept_id` | |||
| <if test="ew.sqlSegment != '' and ew.sqlSegment != null"> | |||
| <where> | |||
| ${ew.sqlSegment} | |||
| </where> | |||
| </if> | |||
| </select> | |||
| </mapper> | |||