Commit f28c5bff by 吴迪

【修改】bug修改

parent 60135a7f
...@@ -71,6 +71,7 @@ public class MedicalController extends AbstractController { ...@@ -71,6 +71,7 @@ public class MedicalController extends AbstractController {
if(medical.getReleasetime()==null) { if(medical.getReleasetime()==null) {
medical.setReleasetime(new Date()); medical.setReleasetime(new Date());
} }
dealMedicalTypeId(medical.getType(),medical);
medicalService.save(medical); medicalService.save(medical);
return R.ok("新增成功!"); return R.ok("新增成功!");
} }
...@@ -87,6 +88,7 @@ public class MedicalController extends AbstractController { ...@@ -87,6 +88,7 @@ public class MedicalController extends AbstractController {
medical.setEditor(username); medical.setEditor(username);
medical.setLasteditor(username); medical.setLasteditor(username);
medical.setUpdatetime(new Date()); medical.setUpdatetime(new Date());
dealMedicalTypeId(medical.getType(),medical);
medicalService.updateById(medical); medicalService.updateById(medical);
return R.ok("修改成功!"); return R.ok("修改成功!");
} }
...@@ -170,4 +172,14 @@ public class MedicalController extends AbstractController { ...@@ -170,4 +172,14 @@ public class MedicalController extends AbstractController {
} }
private void dealMedicalTypeId(String type,MedicalEntity medical) {
if(StringUtils.isNotBlank(type)) {
String medicalTypeId = medicalService.getMedicalTypeId(type);
medical.setTypeid(Integer.parseInt(medicalTypeId));
}
}
} }
...@@ -3,6 +3,7 @@ package io.office.modules.manage.dao; ...@@ -3,6 +3,7 @@ package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.MedicalEntity; import io.office.modules.manage.entity.MedicalEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -20,4 +21,5 @@ public interface MedicalDao extends BaseMapper<MedicalEntity> { ...@@ -20,4 +21,5 @@ public interface MedicalDao extends BaseMapper<MedicalEntity> {
List<Map<String, Object>> getMedicalTypeList(); List<Map<String, Object>> getMedicalTypeList();
String getMedicalTypeId(@Param("typeName") String typeName);
} }
...@@ -37,6 +37,8 @@ public class MedicalEntity implements Serializable { ...@@ -37,6 +37,8 @@ public class MedicalEntity implements Serializable {
* $column.comments * $column.comments
*/ */
private String type; private String type;
@TableField("typeid")
private Integer typeid;
/** /**
* $column.comments * $column.comments
*/ */
......
...@@ -20,5 +20,7 @@ public interface MedicalService extends IService<MedicalEntity> { ...@@ -20,5 +20,7 @@ public interface MedicalService extends IService<MedicalEntity> {
List<Map<String, Object>> getMedicalTypeList(); List<Map<String, Object>> getMedicalTypeList();
String getMedicalTypeId(String typeName);
} }
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import io.netty.util.internal.StringUtil; import io.netty.util.internal.StringUtil;
import io.office.modules.manage.dao.MedicalDao; import io.office.modules.manage.dao.MedicalDao;
import io.office.modules.manage.entity.MedicalEntity; import io.office.modules.manage.entity.MedicalEntity;
...@@ -37,10 +38,17 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i ...@@ -37,10 +38,17 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i
} else { } else {
medicalEntityQueryWrapper.gt("level",0); medicalEntityQueryWrapper.gt("level",0);
} }
if(!StringUtil.isNullOrEmpty(String.valueOf(params.get("sidx")))){
if(String.valueOf(params.get("sidx")).equalsIgnoreCase("type")) {
params.put("sidx","typeid");
}
}
IPage<MedicalEntity> page = this.page( IPage<MedicalEntity> page = this.page(
new Query<MedicalEntity>().getPage(params), new Query<MedicalEntity>().getPage(params),
medicalEntityQueryWrapper medicalEntityQueryWrapper
); );
return new PageUtils(page); return new PageUtils(page);
} }
...@@ -50,4 +58,10 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i ...@@ -50,4 +58,10 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i
return list; return list;
} }
@Override
public String getMedicalTypeId(String typeName) {
return medicalDao.getMedicalTypeId(typeName);
}
} }
\ No newline at end of file
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
<result property="inputDate" column="inputDate"/> <result property="inputDate" column="inputDate"/>
</resultMap> </resultMap>
<select id="getMedicalTypeList" resultType="java.util.Map"> <select id="getMedicalTypeList" resultType="java.util.Map">
select * from medical_type t select * from medical_type t order by t.id asc
</select> </select>
<select id="getMedicalTypeId" parameterType="string" resultType="string">
select * from medical_type where typeName=#{typeName}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment