mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 09:30:05 +08:00
代码生成:进一步完成 erp 模版
This commit is contained in:
parent
7c48aaba8a
commit
a51e9645ef
@ -1,34 +1,31 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import cn.iocoder.yudao.module.infra.service.demo12.InfraDemo12StudentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 学生")
|
||||
@RestController
|
||||
@ -94,22 +91,88 @@ public class InfraDemo12StudentController {
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@GetMapping("/demo12-student/list-by-student-id")
|
||||
@Operation(summary = "获得学生联系人列表")
|
||||
@GetMapping("/demo12-student-contact/page")
|
||||
@Operation(summary = "获得学生联系人分页")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<List<InfraDemo12StudentContactDO>> getDemo12StudentContactListByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demo12StudentService.getDemo12StudentContactListByStudentId(studentId));
|
||||
public CommonResult<PageResult<InfraDemo12StudentContactDO>> getDemo12StudentContactPage(PageParam pageReqVO,
|
||||
@RequestParam("studentId") Long studentId) {
|
||||
return success(demo12StudentService.getDemo12StudentContactPage(pageReqVO, studentId));
|
||||
}
|
||||
|
||||
@PostMapping("/demo12-student-contact/create")
|
||||
@Operation(summary = "创建学生联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:create')")
|
||||
public CommonResult<Long> createDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
return success(demo12StudentService.createDemo12StudentContact(demo12StudentContact));
|
||||
}
|
||||
|
||||
@PutMapping("/demo12-student-contact/update")
|
||||
@Operation(summary = "更新学生联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:update')")
|
||||
public CommonResult<Boolean> updateDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
demo12StudentService.updateDemo12StudentContact(demo12StudentContact);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/demo12-student-contact/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除学生联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo12StudentContact(@RequestParam("id") Long id) {
|
||||
demo12StudentService.deleteDemo12StudentContact(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/demo12-student-contact/get")
|
||||
@Operation(summary = "获得学生联系人")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<InfraDemo12StudentContactDO> getDemo12StudentContact(@RequestParam("id") Long id) {
|
||||
return success(demo12StudentService.getDemo12StudentContact(id));
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
@GetMapping("/demo12-student/get-by-student-id")
|
||||
@Operation(summary = "获得学生班主任")
|
||||
@GetMapping("/demo12-student-teacher/page")
|
||||
@Operation(summary = "获得学生班主任分页")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacherByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demo12StudentService.getDemo12StudentTeacherByStudentId(studentId));
|
||||
public CommonResult<PageResult<InfraDemo12StudentTeacherDO>> getDemo12StudentTeacherPage(PageParam pageReqVO,
|
||||
@RequestParam("studentId") Long studentId) {
|
||||
return success(demo12StudentService.getDemo12StudentTeacherPage(pageReqVO, studentId));
|
||||
}
|
||||
|
||||
@PostMapping("/demo12-student-teacher/create")
|
||||
@Operation(summary = "创建学生班主任")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:create')")
|
||||
public CommonResult<Long> createDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
return success(demo12StudentService.createDemo12StudentTeacher(demo12StudentTeacher));
|
||||
}
|
||||
|
||||
@PutMapping("/demo12-student-teacher/update")
|
||||
@Operation(summary = "更新学生班主任")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:update')")
|
||||
public CommonResult<Boolean> updateDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
demo12StudentService.updateDemo12StudentTeacher(demo12StudentTeacher);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/demo12-student-teacher/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除学生班主任")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo12StudentTeacher(@RequestParam("id") Long id) {
|
||||
demo12StudentService.deleteDemo12StudentTeacher(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/demo12-student-teacher/get")
|
||||
@Operation(summary = "获得学生班主任")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacher(@RequestParam("id") Long id) {
|
||||
return success(demo12StudentService.getDemo12StudentTeacher(id));
|
||||
}
|
||||
|
||||
}
|
@ -50,8 +50,4 @@ public class InfraDemo12StudentBaseVO {
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String memo;
|
||||
|
||||
private List<InfraDemo12StudentContactDO> demo12StudentContacts;
|
||||
|
||||
private InfraDemo12StudentTeacherDO demo12StudentTeacher;
|
||||
|
||||
}
|
@ -17,8 +17,10 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface InfraDemo12StudentContactMapper extends BaseMapperX<InfraDemo12StudentContactDO> {
|
||||
|
||||
default List<InfraDemo12StudentContactDO> selectListByStudentId(Long studentId) {
|
||||
return selectList(InfraDemo12StudentContactDO::getStudentId, studentId);
|
||||
default PageResult<InfraDemo12StudentContactDO> selectPage(PageParam reqVO, Long studentId) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentContactDO>()
|
||||
.eq(InfraDemo12StudentContactDO::getStudentId, studentId)
|
||||
.orderByDesc(InfraDemo12StudentContactDO::getId));
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
|
@ -17,8 +17,10 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface InfraDemo12StudentTeacherMapper extends BaseMapperX<InfraDemo12StudentTeacherDO> {
|
||||
|
||||
default InfraDemo12StudentTeacherDO selectByStudentId(Long studentId) {
|
||||
return selectOne(InfraDemo12StudentTeacherDO::getStudentId, studentId);
|
||||
default PageResult<InfraDemo12StudentTeacherDO> selectPage(PageParam reqVO, Long studentId) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentTeacherDO>()
|
||||
.eq(InfraDemo12StudentTeacherDO::getStudentId, studentId)
|
||||
.orderByDesc(InfraDemo12StudentTeacherDO::getId));
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 学生 Service 接口
|
||||
@ -65,22 +66,84 @@ public interface InfraDemo12StudentService {
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
/**
|
||||
* 获得学生联系人列表
|
||||
* 获得学生联系人分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param studentId 学生编号
|
||||
* @return 学生联系人列表
|
||||
* @return 学生联系人分页
|
||||
*/
|
||||
List<InfraDemo12StudentContactDO> getDemo12StudentContactListByStudentId(Long studentId);
|
||||
PageResult<InfraDemo12StudentContactDO> getDemo12StudentContactPage(PageParam pageReqVO, Long studentId);
|
||||
|
||||
/**
|
||||
* 创建学生联系人
|
||||
*
|
||||
* @param demo12StudentContact 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact);
|
||||
|
||||
/**
|
||||
* 更新学生联系人
|
||||
*
|
||||
* @param demo12StudentContact 更新信息
|
||||
*/
|
||||
void updateDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact);
|
||||
|
||||
/**
|
||||
* 删除学生联系人
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo12StudentContact(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生联系人
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生联系人
|
||||
*/
|
||||
InfraDemo12StudentContactDO getDemo12StudentContact(Long id);
|
||||
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
/**
|
||||
* 获得学生班主任
|
||||
* 获得学生班主任分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param studentId 学生编号
|
||||
* @return 学生班主任
|
||||
* @return 学生班主任分页
|
||||
*/
|
||||
InfraDemo12StudentTeacherDO getDemo12StudentTeacherByStudentId(Long studentId);
|
||||
PageResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId);
|
||||
|
||||
/**
|
||||
* 创建学生班主任
|
||||
*
|
||||
* @param demo12StudentTeacher 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher);
|
||||
|
||||
/**
|
||||
* 更新学生班主任
|
||||
*
|
||||
* @param demo12StudentTeacher 更新信息
|
||||
*/
|
||||
void updateDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher);
|
||||
|
||||
/**
|
||||
* 删除学生班主任
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo12StudentTeacher(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生班主任
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生班主任
|
||||
*/
|
||||
InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id);
|
||||
|
||||
}
|
@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper;
|
||||
@ -37,31 +38,21 @@ public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService
|
||||
private InfraDemo12StudentTeacherMapper demo12StudentTeacherMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createDemo12Student(InfraDemo12StudentCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
InfraDemo12StudentDO demo12Student = InfraDemo12StudentConvert.INSTANCE.convert(createReqVO);
|
||||
demo12StudentMapper.insert(demo12Student);
|
||||
|
||||
// 插入子表
|
||||
createDemo12StudentContactList(demo12Student.getId(), createReqVO.getDemo12StudentContacts());
|
||||
createDemo12StudentTeacher(demo12Student.getId(), createReqVO.getDemo12StudentTeacher());
|
||||
// 返回
|
||||
return demo12Student.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDemo12Student(InfraDemo12StudentUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemo12StudentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
InfraDemo12StudentDO updateObj = InfraDemo12StudentConvert.INSTANCE.convert(updateReqVO);
|
||||
demo12StudentMapper.updateById(updateObj);
|
||||
|
||||
// 更新子表
|
||||
updateDemo12StudentContactList(updateReqVO.getId(), updateReqVO.getDemo12StudentContacts());
|
||||
updateDemo12StudentTeacher(updateReqVO.getId(), updateReqVO.getDemo12StudentTeacher());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,21 +92,31 @@ public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@Override
|
||||
public List<InfraDemo12StudentContactDO> getDemo12StudentContactListByStudentId(Long studentId) {
|
||||
return demo12StudentContactMapper.selectListByStudentId(studentId);
|
||||
public PageResult<InfraDemo12StudentContactDO> getDemo12StudentContactPage(PageParam pageReqVO, Long studentId) {
|
||||
return demo12StudentContactMapper.selectPage(pageReqVO, studentId);
|
||||
}
|
||||
|
||||
private void createDemo12StudentContactList(Long studentId, List<InfraDemo12StudentContactDO> list) {
|
||||
list.forEach(o -> o.setStudentId(studentId));
|
||||
demo12StudentContactMapper.insertBatch(list);
|
||||
@Override
|
||||
public Long createDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
demo12StudentContactMapper.insert(demo12StudentContact);
|
||||
return demo12StudentContact.getId();
|
||||
}
|
||||
|
||||
private void updateDemo12StudentContactList(Long studentId, List<InfraDemo12StudentContactDO> list) {
|
||||
deleteDemo12StudentContactByStudentId(studentId);
|
||||
list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
|
||||
createDemo12StudentContactList(studentId, list);
|
||||
@Override
|
||||
public void updateDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
demo12StudentContactMapper.updateById(demo12StudentContact);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo12StudentContact(Long id) {
|
||||
demo12StudentContactMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemo12StudentContactDO getDemo12StudentContact(Long id) {
|
||||
return demo12StudentContactMapper.selectById(id);
|
||||
}
|
||||
|
||||
private void deleteDemo12StudentContactByStudentId(Long studentId) {
|
||||
demo12StudentContactMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
@ -123,27 +124,31 @@ public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
@Override
|
||||
public InfraDemo12StudentTeacherDO getDemo12StudentTeacherByStudentId(Long studentId) {
|
||||
return demo12StudentTeacherMapper.selectByStudentId(studentId);
|
||||
public PageResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId) {
|
||||
return demo12StudentTeacherMapper.selectPage(pageReqVO, studentId);
|
||||
}
|
||||
|
||||
private void createDemo12StudentTeacher(Long studentId, InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
if (demo12StudentTeacher == null) {
|
||||
return;
|
||||
}
|
||||
demo12StudentTeacher.setStudentId(studentId);
|
||||
@Override
|
||||
public Long createDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
demo12StudentTeacherMapper.insert(demo12StudentTeacher);
|
||||
return demo12StudentTeacher.getId();
|
||||
}
|
||||
|
||||
private void updateDemo12StudentTeacher(Long studentId, InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
if (demo12StudentTeacher == null) {
|
||||
return;
|
||||
}
|
||||
demo12StudentTeacher.setStudentId(studentId);
|
||||
demo12StudentTeacher.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
|
||||
demo12StudentTeacherMapper.insertOrUpdate(demo12StudentTeacher);
|
||||
@Override
|
||||
public void updateDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
demo12StudentTeacherMapper.updateById(demo12StudentTeacher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo12StudentTeacher(Long id) {
|
||||
demo12StudentTeacherMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id) {
|
||||
return demo12StudentTeacherMapper.selectById(id);
|
||||
}
|
||||
|
||||
private void deleteDemo12StudentTeacherByStudentId(Long studentId) {
|
||||
demo12StudentTeacherMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
@ -192,6 +192,16 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/${subSimpleClassName_strikeCase}/get")
|
||||
@Operation(summary = "获得${subTable.classComment}")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
public CommonResult<${subTable.className}DO> get${subSimpleClassName}(@RequestParam("id") ${subPrimaryColumn.javaType} id) {
|
||||
return success(${classNameVar}Service.get${subSimpleClassName}(id));
|
||||
}
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
@ -132,6 +132,14 @@ public interface ${table.className}Service {
|
||||
*/
|
||||
void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id);
|
||||
|
||||
/**
|
||||
* 获得${subTable.classComment}
|
||||
*
|
||||
* @param id 编号
|
||||
* @return ${subTable.classComment}
|
||||
*/
|
||||
${subTable.className}DO get${subSimpleClassName}(${subPrimaryColumn.javaType} id);
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
@ -198,6 +198,11 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
${subClassNameVars.get($index)}Mapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ${subTable.className}DO get${subSimpleClassName}(${subPrimaryColumn.javaType} id) {
|
||||
return ${subClassNameVars.get($index)}Mapper.selectById(id);
|
||||
}
|
||||
|
||||
## 情况二:非 MASTER_ERP 时,支持批量的新增、修改操作
|
||||
#else
|
||||
#if ( $subTable.subJoinMany)
|
||||
|
@ -95,5 +95,10 @@ export const update${subSimpleClassName} = async (data) => {
|
||||
export const delete${subSimpleClassName} = async (id: number) => {
|
||||
return await request.delete({ url: `${baseURL}/${subSimpleClassName_strikeCase}/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 获得${subTable.classComment}
|
||||
export const get${subSimpleClassName} = async (id: number) => {
|
||||
return await request.get({ url: `${baseURL}/${subSimpleClassName_strikeCase}/get?id=` + id })
|
||||
}
|
||||
#end
|
||||
#end
|
@ -30,7 +30,7 @@
|
||||
<el-input v-model="formData.${javaField}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
#elseif($column.htmlType == "imageUpload")## 图片上传
|
||||
<el-form-item label="${comment}">
|
||||
<el-form-item label="${comment}" prop="${javaField}">
|
||||
<UploadImg v-model="formData.${javaField}" />
|
||||
</el-form-item>
|
||||
#elseif($column.htmlType == "fileUpload")## 文件上传
|
||||
@ -149,7 +149,7 @@ const open = async (type: string, id?: number, ${subJoinColumn.javaField}: numbe
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
formData.${subJoinColumn.javaField} = ${subJoinColumn.javaField}
|
||||
formData.value.${subJoinColumn.javaField} = ${subJoinColumn.javaField}
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
|
@ -27,7 +27,7 @@
|
||||
<el-input v-model="formData.${javaField}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
#elseif($column.htmlType == "imageUpload")## 图片上传
|
||||
<el-form-item label="${comment}">
|
||||
<el-form-item label="${comment}" prop="${javaField}">
|
||||
<UploadImg v-model="formData.${javaField}" />
|
||||
</el-form-item>
|
||||
#elseif($column.htmlType == "fileUpload")## 文件上传
|
||||
|
Loading…
Reference in New Issue
Block a user